I have some Java Hibernate code which is intended to select those rows in an Oracle table where a DATE value (mapped to startDate
) is at least one hour ago. To test this, I insert a row directly with a value of Oracle's sysdate
and then run the code. Prior to the switch back from BST at the weekend, my code was returning the row, but now zero rows are being returned. I would have expected this to always return zero rows. Is my code correct?
int cutOffMillis = 1 * 3600 * 1000;
Calendar cal = GregorianCalendar.getInstance();
cal.add(Calendar.MILLISECOND, -cutOffMillis);
Session session = sessionFactory.getCurrentSession();
Criteria criteria = session.createCriteria(DbReport.class);
criteria.add(Restrictions.lt("startDate", cal.getTime()));
return criteria.list();