Return-Path: Delivered-To: apmail-ibatis-dev-archive@www.apache.org Received: (qmail 80566 invoked from network); 28 Jun 2007 18:54:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Jun 2007 18:54:35 -0000 Received: (qmail 8222 invoked by uid 500); 28 Jun 2007 18:54:37 -0000 Delivered-To: apmail-ibatis-dev-archive@ibatis.apache.org Received: (qmail 8211 invoked by uid 500); 28 Jun 2007 18:54:37 -0000 Mailing-List: contact dev-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ibatis.apache.org Delivered-To: mailing list dev@ibatis.apache.org Received: (qmail 8191 invoked by uid 99); 28 Jun 2007 18:54:37 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jun 2007 11:54:36 -0700 X-ASF-Spam-Status: No, hits=2.3 required=10.0 tests=HTML_MESSAGE,MAILTO_TO_SPAM_ADDR,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of jeffgbutler@gmail.com designates 64.233.162.224 as permitted sender) Received: from [64.233.162.224] (HELO nz-out-0506.google.com) (64.233.162.224) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jun 2007 11:54:31 -0700 Received: by nz-out-0506.google.com with SMTP id x3so210857nzd for ; Thu, 28 Jun 2007 11:54:10 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=n2TDflf3ySFRLO4HNaxzUaZoxQ13I6eqkYT4wQlMCypPvGaCqTHlBsP7cE/j/ZiRIFAyjYD6PwuVFVsgtWgLhj8TTZCT/PS+bMaIYnuWUgRDkaSXpEO6/eOqtf8CLw4up3QgxGkDwJ3XGpKHsGz41z51azoYi4RSl3zWntNFyzc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=jq2N5cBAP0xWMUCCCUiQRzkx8mqf/O3gyI/L5PVOGU2ziBIU/Qpl59w4asvcn/ZgNohf7LGlTdEILbLRsEtp/w5pq0GFo7xDGlOi3e9qsjHqF3a41RXeCEYRhfJ08zkETnxuGoBiDPUPKNqOa9lbbMuQYVFAMphy4vxIJOieFQ8= Received: by 10.114.174.2 with SMTP id w2mr1805576wae.1183056849504; Thu, 28 Jun 2007 11:54:09 -0700 (PDT) Received: by 10.115.111.12 with HTTP; Thu, 28 Jun 2007 11:54:09 -0700 (PDT) Message-ID: Date: Thu, 28 Jun 2007 13:54:09 -0500 From: "Jeff Butler" To: dev@ibatis.apache.org Subject: Re: iBatis bug report In-Reply-To: <11348464.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_48982_5027856.1183056849253" References: <11348464.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_48982_5027856.1183056849253 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline There have been similar reports in the past. Would you try the latest version (2.3) to see if you still have the error? Also, this known bug may be related: http://issues.apache.org/jira/browse/IBATIS-357 It might seem unrelated on the surface, but I belive the error maybe in the same area of the code. Anyway, let us know if it's still broken with the latest version. If we can get a reproducible test case, then we can take a look at it. Jeff Butler On 6/28/07, lee_will wrote: > > > I came across the issue when I used TypeHandler in and I > believe > it's a bug. Here is the case: > There're two columns, "date_read" and "date_created" in the "messages" > table > (MySql database), they are type of "Datetime" and "Timestamp" > respectively. > I was trying to convert them to string using type handler > (SimsDateToCharTypeHandler). > > type="myPackage.util.SimsDateToCharTypeHandler" /> > > > typeHandler="myDateToChar "/> > typeHandler="myDateToChar "/> > > > > > > > > "date_read" can be "null" value but "date_created" is always populated > with > "current time" in database. When the order of elements in is > as > above and if "date_read" is NULL, "dateCreated" property in "MassageInfo" > object will be NULL. This is not right since "date_created" HAS value so > that "dateCreated" property should be something like "07/01/2006 11:30", > rather than "NULL". > > However if I reverse the order of elements in , i.e., > > > typeHandler="myDateToChar "/> > typeHandler="myDateToChar "/> > > > > Then I'll get correct result, e.g., dateCreated could be "07/01/2006" but > "dateRead" is null. > > The iBatis version is 2, I'm not sure if you've fixed it in the latest > version. > -- > View this message in context: > http://www.nabble.com/iBatis-bug-report-tf3995995.html#a11348464 > Sent from the iBATIS - Dev mailing list archive at Nabble.com. > > ------=_Part_48982_5027856.1183056849253 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
There have been similar reports in the past.  Would you try the latest version (2.3) to see if you still have the error?  Also, this known bug may be related:
 
 
It might seem unrelated on the surface, but I belive the error maybe in the same area of the code.
 
Anyway, let us know if it's still broken with the latest version.  If we can get a reproducible test case, then we can take a look at it.
 
Jeff Butler

 
On 6/28/07, lee_will <liwy00@yahoo.com> wrote:

I came across the issue when I used TypeHandler in <resultMap> and I believe
it's a bug. Here is the case:
There're two columns, "date_read" and "date_created" in the "messages" table
(MySql database), they are type of "Datetime" and "Timestamp" respectively.
I was trying to convert them to string using type handler
(SimsDateToCharTypeHandler).

<typeAlias alias="myDateToChar"
type="myPackage.util.SimsDateToCharTypeHandler" />

<resultMap id="messageInfoResult" class="myPackage.MassageInfo ">
       <result property="dateRead" column="date_read"
typeHandler="myDateToChar "/>
       <result property="dateCreated" column="date_created"
typeHandler="myDateToChar "/>

   <!-- more mapping -->
</resultMap>


<select id="getMessagesByUserName" resultMap="messageInfoResult" >
SELECT
   date_read, date_created
FROM messages
</select>

"date_read" can be "null" value but "date_created" is always populated with
"current time" in database. When the order of elements in <resultMap> is as
above and if "date_read" is NULL,  "dateCreated" property in "MassageInfo"
object will be NULL. This is not right since "date_created" HAS value so
that "dateCreated" property should be something like "07/01/2006 11:30",
rather than "NULL".

However if I reverse the order of elements in <resultMap>, i.e.,
<resultMap id="messageInfoResult" class="myPackage.MassageInfo">
<!-- order of these two is reversed -->
       <result property="dateCreated" column="date_created"
typeHandler="myDateToChar "/>
       <result property="dateRead" column="date_read"
typeHandler="myDateToChar "/>
   <!-- more mapping -->
</resultMap>

Then I'll get correct result, e.g., dateCreated could be "07/01/2006" but
"dateRead" is null.

The iBatis version is 2, I'm not sure if you've fixed it in the latest
version.
--
View this message in context: http://www.nabble.com/iBatis-bug-report-tf3995995.html#a11348464
Sent from the iBATIS - Dev mailing list archive at Nabble.com.


------=_Part_48982_5027856.1183056849253--