openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremy Bauer" <>
Subject Re: current_date and persistent date field
Date Thu, 04 Sep 2008 19:13:38 GMT

It isn't very elegant, but you could try using a native query with a
cast to produce the result.  I was able to get the native query below
to produce only Orders for the current date using DB2. My 'created'
field is defined as a TIMESTAMP, which is similar to the DATETIME

        query="select * from ORDER where CAST(created AS DATE) = current_date",

This is, of course, DB specific so it may or may not work for with
your DB (SQL Server?).  I've been searching for a means to do
something similar with JPQL but haven't found anything yet.


View raw message