ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim <deadmo...@gmail.com>
Subject Re: Java.util.calendar to SQLType ??
Date Fri, 16 Jan 2009 12:44:57 GMT
I wonder, what's the motivation behind making Calendar an object property?
If you need some Calendar specific operations, create some accessor/mutator
methods to hide the actual Calendar instance. This way you won't need
explicit TypeHandlers and your implementation won't depend on the Calendar
(which isn't the best piece of API for time manipulation).

On Thu, Jan 15, 2009 at 10:13 PM, Petr V. <greatman787@yahoo.com> wrote:

> Database schema has column of type Timestamp .
>
> Java POJO has corresponding property defined as java.util.Calendar
>
> Result Map is defined as
>
> <resultMap class="Job" id="JobResult">
>     <result column="STIME" jdbcType="TIMESTAMP"
> javaType="java.util.Calendar" property="sTime" />
> </resultMap>
>
> I understand, I would have to define typeHandler to convert jdbc type to
> java Calendar.
>
> I am wondering what should I define jdbcType is my sql map, should it be
> TimeStamp or should it be of type date. What would be the better?
>
> Thanks,
>
> Petr
>

Mime
View raw message