ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: When to use jdbcType or javaType
Date Thu, 03 Aug 2006 21:27:23 GMT
In my experience setting the jdbcType is important in parameter maps, either
explicit or inline, in these cases:

1. If the value can be nullable - because it allows iBATIS to call a type
specific setNull() function.  Some drivers (cough DB2 cough) cannot deal
with an unknown jdbc type on setNull().
2. When you're mapping java.util.Date to TIMESTAMP, DATE, and TIME columns
(this is a good practice - best to avoid the java.sql versions if possible)

Other than that I don't think you really need these values unless you're
doing type handlers or trying to override iBATIS' default TypeHandler
calculation.

Jeff Butler


On 8/3/06, jaybytez <jaybytez@gmail.com> wrote:
>
>
> I have been using both jdbcType and javaType everytime when creating a
> parameterMap or resultMap.  Is this necessary?  I am using standard
> drivers
> for Oracle 9i.  I read the documentation, but was not totally clear if
> there
> are performance issues or scalability issues by not doing this?  I am just
> trying to figure out whether its always necessary so I can simplify the
> sql
> map files for developers and so they don't have to add unnecessary
> configuration.  Is it only necessary when a value maybe null or using a
> type
> handler?
>
> <resultMap id="zipCodeRegion" class="providerZipCodeTO">
>    <result property="zipCode" column="zrl_zip_code" jdbcType="VARCHAR"
> javaType="string"/>
>    <result property="region" column="zrl_region_cd" jdbcType="VARCHAR"
> javaType="string"/>
>    <result property="state" column="zrl_state" jdbcType="CHAR"
> javaType="string"/>
>    <result property="tprZipCode" column="zrl_tpr_zip_flag" jdbcType="CHAR"
> javaType="string"/>
> </resultMap>
>
> <parameterMap id="loadLogParameters" class="java.util.Map">
>    <parameter property="startTime" jdbcType="TIMESTAMP"
> javaType="java.sql.Timestamp"/>
>    <parameter property="userId" jdbcType="VARCHAR" javaType="string"/>
> </parameterMap>
>
> Thanks,
>
> Jay
> --
> View this message in context:
> http://www.nabble.com/When-to-use-jdbcType-or-javaType-tf2048046.html#a5640671
> Sent from the iBATIS - User - Java forum at Nabble.com.
>
>

Mime
View raw message