title: Java persistence date query
body: <p>I have....</p>
  
  <pre><code>string qString = "select e from table where id= :id and trunc(Date) = TO_Date('03/04/2010','MM/DD/YYYY')
  
  Query newQuery = entityManager.createNamedQuery(qstring)
  newQuery.setParameter("id",id);
  </code></pre>
  
  <p>How do I set the date part rather than hard coding it?</p>
  
  <p>I have tried
  <code>newQuery.setParameter("date",date,TemporalType.Date)</code> but it hasn't worked for me. Any pointers?
  I have also tried to use just 'newQuery.setParameter("date",date)' and used date as an argument ending me with...</p>
  
  <pre><code>string qString = "select e from table where id= :id and trunc(Date) = :date
  </code></pre>
  
  <p>, but I believe they aren't formatted correctly, what is the correct way to do this?</p>
  
  <p><em><strong></em>*UPDATE***</strong>  I am trying to do it with SQL date. Will keep you posted!!! </p>