If you are using JPQL it seems to be seriously lacking the functions to select elements of the date.
The best suggestion that I've seen is that in your DAO function you pass in two values, one for the
first millisecond of the day and one for the last, and compare your actual date value to see if it
lies between them.
The alternative, which depends upon your system configuration, is to use an SQL native query -
depending upon the db you are using there are normally 'day' 'hour' 'minute' etc functions. For
example in postgres, you can use EXTRACT(DAY FROM TIMESTAMP, 'date') - but that won't work in JPQL.
See here for a further discussion - at the end Quintin Beukes discusses it pretty well:
> http://old.nabble.com/how-to-compare-2-dates-in-a-JPA-QL-query-td18959789.html
Regards
Alan
You need to query on a 24 hour time range
You need to query on a 24 hour time range
-- Alan Chaney CTO and Founder, Mechnicality, Inc. www.mechnicality.com