I am using the following code to retrieve all the records that their time column is passed but it does not show anything.
Criteria cre = session.createCriteria(Timing.class, "timing")
.add(Restrictions.le("timing.time", getCurrentTime()));
List<Timing> timing = new ArrayList();
if (cre.list().size() > 1) {
timing = (List<Timing>) cre.list();
}
tx.commit();
System.err.println("Time is:" + timing.get(0).getTime());
<<it does not reach to this line
}
public Date getCurrentTime() {
SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm");
Date date = new Date();
System.out.println("current:" + dateFormat.format(date));
return date;
}
Timing
@Temporal (javax.persistence.TemporalType.TIME)
public Date getTime() {
return time;
}