title: How to set datetime field in MySql using hql
body: <p>I am facing an issue in inserting date in YYYY-mm-dd hh:mm:ss format in MySql DB.
  filed in DB is of type datetime.</p>
  
  <p>I tried it :</p>
  
  <pre><code>Calendar calendar = Calendar.getInstance();
  calendar.setTime(new Date());
  calendar.set(Calendar.MINUTE, startMinute);
  calendar.set(Calendar.SECOND,01);
  Date startTime = 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();
  </code></pre>