开发者

Hibernate HQL query for finding entries older than 3 hours

How sh开发者_运维问答ould I go about setting up HQL condition that would select all the object who's date property is older than 3 hours from now.


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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜