问题描述:

select * from tableA where trunc(order_date) > sysdate -7;

Something like

Criteria criteria = getSession().createCriteria(TableA.class).

add(Restrictions.gt("orderDate", afterSubtracting7DaysFromToday));

网友答案:

Use sqlRestriction to execute sql database functions. Something like this:

Criteria criteria = getSession().createCriteria(TableA.class).
.add(Restrictions.sqlRestriction("trunc(order_date) > sysdate -7"));
相关阅读:
Top