You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Härtel,
Eric <E....@d-trust.net> on 2007/09/14 16:22:29 UTC
TypehandlerCallback
Another newbe question
I did generate some classes by JAXB, so I have a class Application with member time of XMLGregorianCalendar. In the MS SQLServer database I want to store this object in is column of type 'datetime'.
I did implement the TypeHandlerCallback and put the following in the config files
in SqlMapConfig.xml
===================
<typeHandler
javaType="javax.xml.datatype.XMLGregorianCalendar"
jdbcType="TIMESTAMP"
callback="de.my.package.database.TimeTypeHandlerCallback" />
in SqlMap_Application.xml
=========================
<insert id="insertApplication" parameterClass="Application" >
insert into APPLICATION (
APPLICATION_TIME )
values (
#time# )
</insert>
The typehandler is loaded/constructed but not used during execution. I get the following error:
2007-09-14 16:05:41,530 ERROR - de.my.package.database.DatabaseTest.<init>(DatabaseTest.java:89) [main]: com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in SqlMap_Application.xml.
--- The error occurred while applying a parameter map.
--- Check the insertApplication-InlineParameterMap.
--- Check the parameter mapping for the 'time' property.
--- Cause: java.lang.NullPointerException
Trying different JDBC types (DATE, TIME) leads to the same result.
Can anybody give me a clue, where to look for the problem.
greetings, eric