title: JPA query for day ignoring the time
body: <p>Let say you have a class with a java.util.Date field. Maybe a To do class or an Event planner class.</p>
  
  <pre><code>@Temporal(TemporalType.TIMESTAMP)
  private Date startTime;
  </code></pre>
  
  <p>This will map to a datetime column in MySQL.</p>
  
  <p>There are use cases when you want to know precisely when this Event occurs. "What is scheduled for Aug 11, 2011 at 8 PM?" </p>
  
  <p>Sometimes you just want to know which events are planned for a specific date. "What is scheduled for August 11, 2011?"</p>
  
  <p>If your JPAQL is:</p>
  
  <pre><code>SELECT blah blah etc. WHERE ti.startTime = :d1
  </code></pre>
  
  <p>and the parameter is a java.util.Date instance:</p>
  
  <pre><code>query.setParameter("d1", date, TemporalType.DATE);
  </code></pre>
  
  <p>your results will be restricted by the date but <strong><em>also the time.</em></strong> </p>
  
  <p>This is such a common use case that I'm surprised that there is no simple way to do this even in JPA 2.0.</p>
  
  <p>I'd rather not use a vendor specific hack nor play around with strings/substrings.</p>
  
  <p>How have you solved this problem?</p>