title: Hibernate inconsistently returns timestamps in localtime
body: <p>I have a spring application which uses hibernate. The requirement is to persist and retrieve the timestamps in GMT. I have set the application timezone to GMT using context listener as below.</p>
  
  <blockquote>
    <p>TimeZone.setDefault(TimeZone.getTimeZone("GMT"));  </p>
  </blockquote>
  
  <p>While the application now persists the timestamps in GMT consistently, while retrieving the timestamps from hibernate layer are inconsistent. The timestamps are returned some times in PST (the server's timezone). </p>
  
  <p>My data retrieval query is as below</p>
  
  <blockquote>
    <p>Query q=entityManager.createQuery("SELECT DISTINCT f FROM foo as f WHERE f.ID=?1 AND f.ID2=?2 ORDER >BY ID DESC").setParameter(1, id1).setParameter(2, id2);</p>
    
    <p>q.setFirstResult(skip).setMaxResults(top).getResultList();</p>
  </blockquote>
  
  <p>Any ideas on solving this issue?</p>