简体   繁体   中英

Criteria hibernate

my code

session.createCriteria(Input.class);
      DateFormat format = 
new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
      Date startDate = 
(Date)format.parse("2005-01-01 00:00:00");
      Date endDate = 
(Date)format.parse("2005-03-03 00:00:00");
      crit.add(Expression.between
("inputDate", new Date(startDate.getTime()),
 new Date(endDate.getTime()))); 

This code return a list, but there is no element present in it. i think it doesn't match the condition. Anybody help.

将此作为您的最后一条语句:

crit.add(Expression.between("inputDate", startDate, endDate));

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