title: Getting wrong datetime field value while retrieving date from DB using HIbernate
body: <p>I am using Hibernate 4.3.2. I want to store all my dates in <strong>UTC</strong> in database. I am able to store date in <strong>UTC</strong>. Now I am retrieving date from database using below method. </p>
  
  <pre><code>public void getLastActiveTimeAndCheckForIt(int pageId)
  {
      Criteria criteria = getCurrentSession().createCriteria(MyTable.class, "myTable");
      criteria.add(Restrictions.eq("myTable.id", 1));
      MyTable row = (MyTable) criteria.uniqueResult();
      System.out.println(row.getUpdatedDateTime());
     //output : 2014-06-10 03:05:35.0 and actual date in database : 2014-06-10 08:35:35
  }
  </code></pre>
  
  <p>As I mentioned I am getting different date in output which is stored in database. I am not getting reason why?<BR><BR>
  Some steps I did to configure UTC timezone.<BR>
  <strong>1.</strong> <code>TimeZone.setDefault(TimeZone.getTimeZone("UTC"));</code><BR>
  <strong>2.</strong> <code>System.setProperty("user.timezone", "UTC");</code><BR>
  <strong>3.</strong> <code>I also set my database timezone in UTC.</code></p>