Hibernate HQL query to search for records older than 3 hours

How can I configure the setting of the HQL condition, which selects the entire object whose date is more than 3 hours from now .

+4
source share
1 answer

That 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(); 
+6
source

Source: https://habr.com/ru/post/1342896/


All Articles