Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 45312 invoked from network); 3 Aug 2006 21:27:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 Aug 2006 21:27:50 -0000 Received: (qmail 24221 invoked by uid 500); 3 Aug 2006 21:27:49 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 23899 invoked by uid 500); 3 Aug 2006 21:27:47 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 23888 invoked by uid 99); 3 Aug 2006 21:27:47 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Aug 2006 14:27:47 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of jeffgbutler@gmail.com designates 66.249.92.174 as permitted sender) Received: from [66.249.92.174] (HELO ug-out-1314.google.com) (66.249.92.174) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Aug 2006 14:27:45 -0700 Received: by ug-out-1314.google.com with SMTP id m2so2975562ugc for ; Thu, 03 Aug 2006 14:27:23 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=J/Cy8NQHei17ki2ywGbiIGkcVcMaBoNal7/y/dL0bNcM6nADdirxbk722RFSBe78gbkW2ox0KV2ZXixr6+32eQYrKSDGiCohLZurevjxKuErFEXBdUGowDUCDPC4tBnBgOCI5vLHSz2IIE2TUhYoqqaTeZirgTCVf099H6AgVB8= Received: by 10.67.93.6 with SMTP id v6mr3456859ugl; Thu, 03 Aug 2006 14:27:23 -0700 (PDT) Received: by 10.66.221.15 with HTTP; Thu, 3 Aug 2006 14:27:23 -0700 (PDT) Message-ID: Date: Thu, 3 Aug 2006 16:27:23 -0500 From: "Jeff Butler" To: user-java@ibatis.apache.org Subject: Re: When to use jdbcType or javaType In-Reply-To: <5640671.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_21192_27330714.1154640443617" References: <5640671.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_21192_27330714.1154640443617 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 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? > > > javaType="string"/> > javaType="string"/> > javaType="string"/> > javaType="string"/> > > > > javaType="java.sql.Timestamp"/> > > > > 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. > > ------=_Part_21192_27330714.1154640443617 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
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.


------=_Part_21192_27330714.1154640443617--