You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Alexander Banthien <al...@questech.de> on 2002/08/30 10:25:12 UTC
Torque ISNULL and Dates bug?
Hi people,
I have been experimenting around with torque and the Criteria. I feel
there is a problem. (using torque-3.0-b4.jar and mysql)
I have a two Date columns named ECARD.SEND_DATE and ECARD.SENT_AT but
the straightforward code
-------snip ---------------------
Criteria crit = new Criteria();
java.sql.Date sqlDate = new java.sql.Date((new Date()).getTime());
crit.add(EcardPeer.SENT_AT,Criteria.ISNULL)
crit.add(EcardPeer.SEND_DATE,sqlDate,Criteria.LESS_THAN);
-------snap---------------------
gives me an exception, because the generated SQL is buggy:
SELECT ........ WHERE ECARD.SENT_AT= IS NULL AND
ECARD.SEND_DATE<'20020830094429'
(not the buggy syntax in the first condition)
The workaround is
-------------snip---------------
Criteria crit = new Criteria();
java.sql.Date sqlDate = new java.sql.Date((new
Date()).getTime());
crit.add(EcardPeer.SEND_DATE,sqlDate,Criteria.LESS_THAN);
// Criteria.ISNULL has a bug so we do it like this.
crit.and(EcardPeer.SENT_AT,(Object)" ECARD.SENT_AT IS NULL
",Criteria.CUSTOM);
--------------snap-----------------
--
regards
Alexander Banthien
_______________________________________
Questech GmbH
Schwarzwaldstr. 19
79199 Kirchzarten
Fon: +49 (0)7661 90 35-15
Fax: +49 (0)7661 90 35-20
www.questech.de
_______________________________________
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>