I'd like to convert this DB2 SQL Statement into Hibernate Criteria statements. I'm new to Hibernate and find difficulties to convert to hibernate criteria.
My SQL
SELECT DISTINCT (USER_ID) FROM USERS
where STATUS='EXECUTED' and TRANSACTION_TIME
BETWEEN (SELECT current timestamp -1 MONTH FROM SYSIBM.SYSDUMMY1)
and (SELECT current timestamp FROM SYSIBM.SYSDUMMY1)
However i tried to get the where clause but i not sure how to use distinct and between clause in hibernate criteria
Criteria criteria = session.createCriteria(Users.class);
criteria.add(Restrictions.eq("status", "EXECUTED"));
List<Users> usersList = criteria.list();
I wanted to use it since it gives me cleaner code.
Thanks in advance.