ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andrew.kitc...@kattare.com
Subject Re: Locale problems?
Date Tue, 20 Mar 2007 17:45:15 GMT
Hi Graeme,

> >From your earlier posts:
>
> 1. Local server, local DB works
> 2. Local server, remote DB works.
> 3. Remote server, remote DB fails.

- correct.

> Without actually seeing the log/stacktrace, I wondering whether
>
> 1. It's the conversion from the DB to DATE or
> 2. Some parsing you're doing on the Date object.

- I let ibatis do all the parsing via the sqlmap configuration to java
object, so no parsing done by me. It looks to me like it is the
conversion from the DB to Date, but within ibatis. I have a service
class that calls the getUserByEmailAddress map. It passes a String to
the map and then when it executes throws the stace trace below. Like I
mentioned before - it doesn't do this in either of the first two
scenarios above.

Here are the other pieces of information:


DB Structure
------------

id bigint(11)   PRIMARY KEY
title enum('Mr','Mrs','Ms','Miss','Dr','Prof','Rev')
firstName varchar(60)
lastName varchar(60)
gender enum('Male','Female')
dob date NULL
telephoneNumber varchar(30)
emailAddress varchar(100)
password varchar(12)
newsletter enum('yes','no')
preferredCurrency bigint(11)
activationKey varchar(12)
activated enum('yes','no')
lastLogin datetime


SqlMap XML file - i snipped a few other lines out for unused statements
---------------

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-2.dtd">

<sqlMap namespace="User">

  <resultMap id="userResult" class="user">
    <result property="id" column="id"/>
    <result property="title" column="title"/>
    <result property="firstName" column="firstName"/>
    <result property="lastName" column="lastName"/>
    <result property="gender" column="gender"/>
    <result property="dob" column="dob" jdbcType="date"/>
    <result property="telephoneNumber" column="telephoneNumber"/>
    <result property="emailAddress" column="emailAddress"/>
    <result property="password" column="password"/>
    <result property="newsletter" column="newsletter"/>
    <result property="preferredCurrency" column="preferredCurrency"/>
    <result property="activationKey" column="activationKey"/>
    <result property="activated" column="activated"/>
    <result property="lastLogin" column="lastLogin"/>
  </resultMap>

  <statement id="insertUser" parameterClass="user">
    insert into User (id, title, firstName, lastName, gender, dob,
telephoneNumber, emailAddress,
                      password, newsletter, preferredCurrency,
activationKey, activated, lastLogin)
    values (#id#, #title#, #firstName#, #lastName#, #gender#, #dob#,
#telephoneNumber#, #emailAddress#,
            #password#, #newsletter#, #preferredCurrency#,
#activationKey#, #activated#, #lastLogin#)
  </statement>

  <statement id="getUserByEmailAddress" resultMap="userResult"
parameterClass="string">
    select * from User where emailAddress = #value#
  </statement>

</sqlMap>

DB record
---------
(107, Mr, test, test, Male, 1975-01-15, 8989898, <emailaddress edited>,
123456, yes, 34, QsVUNAA2, no, 2007-03-14 03:54:08)


Stack trace - there are more than one errors!
-----------

Inside UserAction - userCreate
Mar 20, 2007 10:29:50 AM org.apache.struts.action.RequestProcessor
processException
WARNING: Unhandled Exception thrown: class
com.ibatis.dao.client.DaoException
Mar 20, 2007 10:29:50 AM org.apache.catalina.core.StandardWrapperValve
invoke
SEVERE: Servlet.service() for servlet action threw exception
com.ibatis.dao.client.DaoException: Failed to execute queryForObject -
id [getUserByEmailAddress], parameterObject [<emailaddress edited>]. 
Cause: com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in
uk/co/toydreams/shop/persistence/sqlmapdao/sql/User.xml.
--- The error occurred while applying a result map.
--- Check the User.userResult.
--- Check the result mapping for the 'lastLogin' property.
--- Cause: com.ibatis.common.exception.NestedRuntimeException: Error
setting properties of 'BaseObject [107, null, null, null]'.  Cause:
java.text.ParseException: Unparseable date: "1975-01-15"
Caused by: java.text.ParseException: Unparseable date: "1975-01-15"
Caused by: com.ibatis.common.exception.NestedRuntimeException: Error
setting properties of 'BaseObject [107, null, null, null]'.  Cause:
java.text.ParseException: Unparseable date: "1975-01-15"
Caused by: java.text.ParseException: Unparseable date: "1975-01-15"
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in
uk/co/toydreams/shop/persistence/sqlmapdao/sql/User.xml.
--- The error occurred while applying a result map.
--- Check the User.userResult.
--- Check the result mapping for the 'lastLogin' property.
--- Cause: com.ibatis.common.exception.NestedRuntimeException: Error
setting properties of 'BaseObject [107, null, null, null]'.  Cause:
java.text.ParseException: Unparseable date: "1975-01-15"
Caused by: java.text.ParseException: Unparseable date: "1975-01-15"
Caused by: com.ibatis.common.exception.NestedRuntimeException: Error
setting properties of 'BaseObject [107, null, null, null]'.  Cause:
java.text.ParseException: Unparseable date: "1975-01-15"
Caused by: java.text.ParseException: Unparseable date: "1975-01-15"
	at
com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForObject(SqlMapDaoTemplate.java:153)
	at
uk.co.toydreams.shop.persistence.sqlmapdao.UserSqlMapDao.getUserByEmailAddress(UserSqlMapDao.java:37)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at com.ibatis.dao.engine.impl.DaoProxy.invoke(DaoProxy.java:61)
	at $Proxy11.getUserByEmailAddress(Unknown Source)
	at
uk.co.toydreams.shop.service.UserService.getUserByEmailAddress(UserService.java:59)
	at
uk.co.toydreams.shop.actions.user.UserAction.userCreate(UserAction.java:59)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
	at
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
	at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
	at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
	at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
	at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
	at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
	at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:595)

Mime
View raw message