title: Compare Date from the database with current date using jpa
body: <p>I am using JPA 1 with hibernate as provider. I want to compare date of the entity with current date(regardless of time) and I am saving that field as timestamp(as i need it).
  I was getting the correct result when i was using oracle dialect by following code:</p>
  
  <pre><code>select t from Task t where to_date(t.createdOn) = to_date(CURRENT_DATE)
  </code></pre>
  
  <p>but when i switch to sql server(2008), it is not working. I need a generic way so that i can make the query database independent. </p>