Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 63349 invoked from network); 5 May 2010 08:50:54 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 5 May 2010 08:50:54 -0000 Received: (qmail 50542 invoked by uid 500); 5 May 2010 08:50:54 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 50409 invoked by uid 500); 5 May 2010 08:50:52 -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 50402 invoked by uid 99); 5 May 2010 08:50:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 May 2010 08:50:51 +0000 X-ASF-Spam-Status: No, hits=-0.8 required=10.0 tests=AWL,FREEMAIL_FROM,SPF_HELO_PASS,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 May 2010 08:50:46 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1O9aJF-0005Sq-Dm for user-java@ibatis.apache.org; Wed, 05 May 2010 01:50:25 -0700 Message-ID: <28458279.post@talk.nabble.com> Date: Wed, 5 May 2010 01:50:25 -0700 (PDT) From: Jeremy Jardin To: user-java@ibatis.apache.org Subject: Re: date in where clause does not work. In-Reply-To: <28457681.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: jeremy.jardin@gmail.com References: <28447759.post@talk.nabble.com> <28449474.post@talk.nabble.com> <28457681.post@talk.nabble.com> Today, I'm having other kind of pb... My select request return too much rows.. I'm still lauching the same test.. and, in debug mode, i've seen something wrong here : protected void addCriterionForJDBCDate(String condition, Date value, String property) { addCriterion(condition, new java.sql.Date(value.getTime()), property); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } Map map = new HashMap(); map.put("condition", condition); map.put("value", value); criteriaWithSingleValue.add(map); } This is a generated method (abator). The Date value I passed in the method, is a new java.util.Date(). And it's converted as : 1970-01-01 ... why ? I guess the value.getTime() is doing something wrong. Jeremy Jardin wrote: > > well, sure, I _always_ use java.util.Date.. > My sqlMap is an abatorGenerated one.. and it's quite big. > > > "http://ibatis.apache.org/dtd/sql-map-2.dtd"> > > class="fr.gouv.finances.douane.dnsce.corinthe.metier.ibatis.bean.TabChif" > id="ibatorgenerated_BaseResultMap"> > > > > > > > > removeFirstPrepend="iterate"> > > ( > property="oredCriteria[].criteriaWithoutValue"> > $oredCriteria[].criteriaWithoutValue[]$ > > property="oredCriteria[].criteriaWithSingleValue"> > $oredCriteria[].criteriaWithSingleValue[].condition$ > #oredCriteria[].criteriaWithSingleValue[].value# > > property="oredCriteria[].criteriaWithListValue"> > $oredCriteria[].criteriaWithListValue[].condition$ > property="oredCriteria[].criteriaWithListValue[].values"> > #oredCriteria[].criteriaWithListValue[].values[]# > > > property="oredCriteria[].criteriaWithBetweenValue"> > $oredCriteria[].criteriaWithBetweenValue[].condition$ > #oredCriteria[].criteriaWithBetweenValue[].values[0]# and > #oredCriteria[].criteriaWithBetweenValue[].values[1]# > > ) > > > > > > > > nmaves wrote: >> >> Wel ALWAYS use java.util.Date >> >> send us your sqlmap >> >> >> On Tue, May 4, 2010 at 10:03 AM, Jeremy Jardin >> wrote: >> >>> >>> Ok, I'm doing something like that. >>> >>> TabChifExample criteria = new TabChifExample(); >>> criteria.createCriteria().andDatChifGreaterThan (new java.util.Date() ); >>> .. etc... >>> >>> I've seen in the example class that the java.util.Date is casted in >>> java.sql.Date.. >>> >>> >>> >>> Larry Meadors wrote: >>> > >>> > Hm, odd - I've done this hundreds of times with oracle - just passing >>> > a Date object. >>> > >>> > Send the relevant code. >>> > >>> > Larry >>> > >>> > >>> > On Tue, May 4, 2010 at 9:11 AM, Jeremy Jardin >>> >>> > wrote: >>> >> >>> >> Hi, >>> >> >>> >> I'm simply trying to build a request with Date comparaisons.. and >>> ibatis >>> >> still reply me empty list.. >>> >> >>> >> My generated request in logs : >>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - >>> {conn-100000} >>> >> Connection >>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - >>> {conn-100000} >>> >> Preparing Statement: select * from TAB_CHIF where >>> (DAT_CHIF >>> >>>?)order by DAT_CHIF >>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - >>> {pstm-100001} >>> >> Executing Statement: select * from TAB_CHIF where >>> (DAT_CHIF >>> >>>?)order by DAT_CHIF >>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - >>> {pstm-100001} >>> >> Parameters: [2010-05-04] >>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - >>> {pstm-100001} >>> >> Types: [java.sql.Date] >>> >> >>> >> If I launch handly the same request (with a date parsing) in my >>> oracle >>> >> client, there's one row. >>> >> select * from TAB_CHIF where(DAT_CHIF > to_date('2010-05-04', >>> >> 'yyyy-MM-dd')); >>> >> >>> >> >>> >> I guess I've got a dateFormat matter.. but what's the workaround ? >>> >> >>> >> Thanks. >>> >> Jeremy >>> >> -- >>> >> View this message in context: >>> >> >>> http://old.nabble.com/date-in-where-clause-does-not-work.-tp28447759p28447759.html >>> >> Sent from the iBATIS - User - Java mailing list archive at >>> Nabble.com. >>> >> >>> >> >>> >> --------------------------------------------------------------------- >>> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org >>> >> For additional commands, e-mail: user-java-help@ibatis.apache.org >>> >> >>> >> >>> > >>> > --------------------------------------------------------------------- >>> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org >>> > For additional commands, e-mail: user-java-help@ibatis.apache.org >>> > >>> > >>> > >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/date-in-where-clause-does-not-work.-tp28447759p28449474.html >>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com. >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org >>> For additional commands, e-mail: user-java-help@ibatis.apache.org >>> >>> >> >> > > -- View this message in context: http://old.nabble.com/date-in-where-clause-does-not-work.-tp28447759p28458279.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org For additional commands, e-mail: user-java-help@ibatis.apache.org