RE: select question (again)
Hi, personnally, I put : criteria.addSql(date = TO_DATE('2004', '')); But I think there other possibilities -Message d'origine- De : Glauber Andrade [mailto:[EMAIL PROTECTED] Envoyé : jeudi 18 décembre 2003 00:19 À : OJB Users List Objet : select question (again) How do I implement a select like this with OJB Criteria ? select * from TABLE where date = TO_DATE('2004','') (as on Oracle) or select * from TABLE where YEAR(date) = 2004 (as on MySQL) THANKS, Glauber Andrade - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: select question (again)
Hennebelle wrote: personnally, I put : criteria.addSql(date = TO_DATE('2004', '')); There's also: criteria.addEqualTo(date, TO_DATE('2004', '')); Works similar with all operators/'add'-methods on a Criteria. Regards, Martin -- Martin Kalén Curalia AB Web: http://www.curalia.se Orrspelsvägen 2BMail: [EMAIL PROTECTED] SE-182 79 StocksundTel: +46-8-410 064 40 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: select question (again)
Be careful doing this in code that which gets executed a lot in a multi-threaded environment (ie, a servlet container), SDF has some serious synchronization bottlenecks =/ -Brian On Thu, 2003-12-18 at 09:29, Gelhar, Wallace Joseph wrote: Hi, Personally I would use SimpleDateFormat df = new SimpleDateFormat(); criteria.addBetween(date, df.parse(01/01/+year), df.parse(12/31/+year)); This makes it database independent. Wally -Original Message- From: Martin Kalén [mailto:[EMAIL PROTECTED] Sent: Thursday, December 18, 2003 8:00 AM To: OJB Users List Subject: Re: select question (again) Hennebelle wrote: personnally, I put : criteria.addSql(date = TO_DATE('2004', '')); There's also: criteria.addEqualTo(date, TO_DATE('2004', '')); Works similar with all operators/'add'-methods on a Criteria. Regards, Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
select question (again)
How do I implement a select like this with OJB Criteria ? select * from TABLE where date = TO_DATE('2004','') (as on Oracle) or select * from TABLE where YEAR(date) = 2004 (as on MySQL) THANKS, Glauber Andrade - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]