ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Newsham <news...@hawaii.rr.com>
Subject configured type handler not used in insert
Date Mon, 13 Jun 2005 22:43:15 GMT

Hi,

We just recently started using iBatis.  We're using version 2.1.0.  We 
have a few fields whose types are not the basic, built-in supported 
types.  We discovered that we can implement a TypeHandlerCallback for 
each such type.  The type handlers are defined in SqlMapConfig, such as:

<typeHandler javaType='java.lang.Boolean' jdbcType='CHAR' 
callback='com...BooleanTypeHandler'/>

With this handler installed, the type conversion is done automatically 
for queries.  But for inserts, the type conversion is not called (this 
is confirmed with some debug statements in the type handler).  The 
result is a null pointer exception.

I discovered that we can include an explicit, inline type handler within 
the insert map (such as #private,handler=com...BooleanTypeHandler#). 
This is the workaround we're using for now, but the question is, why is 
this explicit mapping necessary when the type handler has been declared 
to handle all boolean types, as shown above?

(P.S.:  Not sure if this stuff is documented here; here are some 
references I found:

http://opensource.atlassian.com/confluence/oss/display/IBATIS/How+do+I+use+a+Custom+Type+Handler+with+complex+property+or+Type+Safe+Enumeration%3F
http://www.mail-archive.com/ibatis-user-java@incubator.apache.org/msg00570.html
)

Thanks,

Jim


Mime
View raw message