persistence@glassfish.java.net

how to compare 2 dates in a JPA QL query

From: chflb <labidi.chifa_at_gmail.com>
Date: Wed, 13 Aug 2008 02:30:54 -0700 (PDT)

hello all,

how can i compare 2 dates in JPA QL ,?

my idea was to convert the dates to String, and i used 'to_char',
but i think it doesn't work in JPA QL;
this is my query(it works in oracle but not in java) :

 Query q=em.createQuery("select sum(o.montant) from Operation o join
o.codTransac t join o.codCaisse c where (t.sens='D')and
(to_char(c.dateCaisse,'MM/DD/YYYY')=to_char(o.dateOp,'MM/DD/YYYY'))");

can some one help me?
thanks


-- 
View this message in context: http://www.nabble.com/how-to-compare-2-dates-in-a-JPA-QL-query-tp18959789p18959789.html
Sent from the java.net - glassfish persistence mailing list archive at Nabble.com.