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, 09 Aug 2006 22:47:31 GMT

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 jdbcType="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/Duplicate-typeHandler-%28same-javaType%2C-different-jdbcType%29-tf2081707.html#a5735284
Sent from the iBATIS - User - Java forum at Nabble.com.


Mime
View raw message