I need a jpql query to find all the LoadFileHistory which finishDate be greater than the currente date (since 00:00:00). For instance greater than 27/11/2012 00:00:00.
I already have this one "select o from LoadFileHistory o where o.finishDate = CURRENT_DATE" but gets me nothing.
You should get today's date to the query like detailed here (java.util.Date has the hour, minute, second too...)
The you should supply it to your query:
Query q = em.createQuery("select o from LoadFileHistory o where o.finishDate > :today ");
q.setParameter("today",todaysDateObject,TemporalType.DATE);
q.getResultList();
In case you are looking for time level filtering with date. This worked for me.
Date now = DateUtils.addMinutes(new Date(), -15);
Query q = em.createQuery("Select u From Users u Where u.dateCreated > :today");
q.setParameter("today",now,TemporalType.TIMESTAMP);
DateUtils is of apache common.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With