title: Converting datetime to a long timestamp in JPQL
body: <p>I have an entity with two columns:</p>
  
  <pre><code>// time when the event happened (stored in UTC)
  @Temporal(TemporalType.TIMESTAMP)
  private Date eventTime;
  
  // timezone offset in milliseconds
  // so local millis are eventTime.getTime() + offset
  @Basic
  private int offset;
  </code></pre>
  
  <p>It appears that in JPQL queries <a href="https://stackoverflow.com/questions/2856386/java-jpql-date-function-to-add-a-time-period-to-another-date">I can't use something</a> like <code>WHERE eventTime + offset &gt; :parameter</code>. But is it possible to work around by casting <code>eventTime</code> to a long in some way? Of course, there is an option of using native queries...</p>
  
  <p>EDIT:
  It isn't supported in the standard and isn't mentioned in OpenJPA documentation, so probably not possible at the moment.</p>