ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From em...@tomashula.cz
Subject TypeHandlerCallback isn't called when target is HashMap
Date Mon, 15 Feb 2010 07:43:40 GMT
Hi all,

I am dealing with one problem regarding type handlers. I created my own
type handler for java.sql.Timestamp and I added the following line to
SqlMapConfig.xml:

<typeHandler javaType="java.sql.Timestamp"
callback="some_package.TimestampHandler" />

This handler works right when I load DB records into objects with defined
classes (i.e. resultClass="SomeClass") or when I use result map and define
the java type directly (i.e. javaType="java.sqlTimestamp" in result
element).

But the handler doesn't apply when I loading DB records into simply
HashMap (i.e. resultClass="HashMap"). In this case my handler isn't used
and as I found out, a handler for java.lang.Object is used instead. But
the corresponding field in hash map is correctly of type
java.sql.Timestamp.

Please, is it a bug or is it a logical approach that I just don't
understand to? Is there any other possibility than writing my own handler
for java.lang.Object or defining result maps for all selects?

I found similar item here
(http://www.mail-archive.com/user-java@ibatis.apache.org/msg11954.html)
but with no reply.

Thanks a lot in advance,
Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message