title: Java CriterialAPI and Date with Milliseconds
body: <p>My setup:</p>
  
  <pre><code> - Oracle DB
   - EclipseLink
   - JPA + CriteriaAPI
  </code></pre>
  
  <p>The database has a table with a <code>DATE</code> field, called <code>BEGIN</code></p>
  
  <pre><code>@Temporal(TemporalType.TIMESTAMP)
  @Column(name = "BEGIN")
  private Date begin;
  </code></pre>
  
  <p>Now I try to select data:</p>
  
  <pre><code>Date date = getDate();
  Predicate p= cb.greaterThanOrEqualTo(tab.&lt;Date&gt;get(TAB_.begin), date);
  </code></pre>
  
  <p>the value in the Database is the following
  <code>09.11.17 15:04:41</code> (Nov, 9th)</p>
  
  <p>the value of <code>date</code> is <code>Thu Nov 09 15:04:41 UTC 2017</code> </p>
  
  <p>Problem: The query does not return a result, however it should since it is the same date.</p>
  
  <p>I tried this: <code>new DateTime(date).toString()</code> which returns <code>2017-11-09T15:04:41.711Z</code></p>
  
  <p>Is the problem due to the <code>711</code> milliseconds??? As a short workaround I did this, however it is terribly ugly
  <code>new DateTime(date).minusSeconds(1).toDate()</code></p>
  
  <p>Is this a known problem? How can I fix it?</p>