Compare two dates with JPA

Posted by Kiva on Stack Overflow See other posts from Stack Overflow or by Kiva
Published on 2009-08-28T15:42:08Z Indexed on 2010/03/31 0:03 UTC
Read the original article Hit count: 578

Filed under:
|
|

Hello everybody,

I need to compare two dates in a JPQL query but it doesn't work.

Here is my query:

Query query = em.createQuery("SELECT h FROM PositionHistoric h, SeoDate d WHERE h.primaryKey.siteDb = :site AND h.primaryKey.engineDb = :engine AND h.primaryKey.keywordDb = :keyword AND h.date = d AND d.date <= :date ORDER BY h.date DESC");

My parameter date is a java.util.Date

My query return a objects list but the dates are upper and lower to my parameter.

Someone kown how to do this ?

Thanks.

© Stack Overflow or respective owner

Related posts about java

Related posts about jpa