Reputation: 26860
How should I go about setting up HQL condition that would select all the object who's date property is older than 3 hours from now.
Upvotes: 6
Views: 11458
Reputation: 73484
This should work.
Calendar cal = Calendar.getInstance();
cal.add(Calendar.HOUR_OF_DAY, -3);
Query q = session.createQuery("from table where date < :date");
q.setCalendarDate("date", cal);
q.list();
Upvotes: 7