ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaybytez <jayby...@gmail.com>
Subject Duplicate typeHandler (same javaType, different jdbcType)
Date Wed, 26 Jul 2006 22:49:18 GMT

Last question on this before I drive you crazy.

TypeHandler gives me accessibility to the SQL Type so I know if the user is
using the typeHandler for two different SQL data types and perform the
necessary get/set based on that type.  For instance, Date and Timestamp
correlate to the same object DateTime (in my application).  So if the type
that is required is a sql Date...I can do the proper get/set for SQL Date,
and likewise for Timestamp.  With TypeHandlerCallback...I will not have that
accessibility.  So if I create a DateTime/Timestamp handler callback and
DateTime/Date handler callback...can I register both in the sqlMapConfig? 
Or would iBatis not know what conversion to do when it hits a DateTime
object?

Current Code:
	<typeHandler javaType="com.healthnet.hnfs.common.util.DateTime" 
		callback="com.foo.dao.datahandler.DateTimeTypeHandler"/>

Future Code:

	<typeHandler jdbcType="TIMESTAMP"
callback="com.foo.dao.datahandler.DateTimeTypeHandler"/>
	<typeHandler javaType="DATE" 	
callback="com.foo.dao.datahandler.DateTimeTypeHandler"/>

Is this correct?  Without stating the javaType for duplication?

Thanks,

jay
-- 
View this message in context: http://www.nabble.com/Difference-between-TypeHandler-and-TypeHandlerCallback-tf2006318.html#a5512495
Sent from the iBATIS - User - Java forum at Nabble.com.


Mime
View raw message