Here, I specifically tried to format the date object with simpleDateFormat before putting it to sleep. check if this works.
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.MINUTE, startMinute);
calendar.set(Calendar.SECOND,01);
Date startTime = dateFormat.parse(dateFormat.format(calendar.getTime();));
String hqlUpdate = "update challenge set start_time = :startTime where challenge_id = :id";
sessionFactory.getCurrentSession().createSQLQuery(hqlUpdate)
.setDate("startTime", startTime)
.setInteger("id", id).executeUpdate();
source
share