title: JPQL SELECT between date statement
body: <p>I would like to convert this SQL statement to a JPQL equivalent.</p>
  
  <pre><code>SELECT * FROM events
  WHERE events_date BETWEEN '2011-01-01' AND '2011-03-31';
  </code></pre>
  
  <p>This correctly retrieves the information from the table <code>events</code>.</p>
  
  <p>In my <code>Events</code> entity     </p>
  
  <pre><code>   @Column(name = "events_date")  
     @Temporal(TemporalType.DATE)  
     private Date eventsDate;
  </code></pre>
  
  <p>So far this is what I have but it is not working.</p>
  
  <pre><code>public List&lt;Events&gt; findAllEvents(Date startDate, Date endDate) {    
    List&lt;Events&gt; allEvents = entityManager.createQuery(
      "SELECT e FROM Events e WHERE t.eventsDate BETWEEN :startDate AND :endDate")  
    .setParameter("startDate", startDate, TemporalType.DATE)  
    .setParameter("endDate", endDate, TemporalType.DATE)  
    .getResultList();
    return allEvents ;  
  }
  </code></pre>
  
  <p>What am I doing wrong? Thanks.</p>