ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Maves <Nathan.Ma...@Sun.COM>
Subject Re: Duplicate typeHandler (same javaType, different jdbcType)
Date Thu, 10 Aug 2006 15:06:41 GMT
Just a thought but why are you writing your own Date/Timestamp  
handlers?  Both of these are covered by TypeHandlers that are bundled  
with ibatis.

You can find their code here http://svn.apache.org/repos/asf/ibatis/ 
trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/engine/type/

If you are trying to do something other then insert/update date  
fields please clarify you problem or question.

Nathan

On Aug 9, 2006, at 4:47 PM, jaybytez wrote:

>
> 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