简体   繁体   中英

Get current month Criteria in Hibernate

I am transforming my jdbc connections to Hibernate Criteria and I have this query:

select sum(tran_amt) from   mytable where tran_date >= trunc(sysdate, 'mm');

The where criteria part is the place am stuck.

Define date as java variable, and compare it to the criteria value. Eg, depending on criteria version of course:

Predicate predicate = criteriaBuilder.ge(from.get("trainDate"), new Date());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM