title: SQL Server, HQL: How to compare SQL server datetime column field to date
body: <p>I have following SQL query which i need to make it work in HQL, I tried couple of solutions but none of them work.(Database : SQL server)</p>
  
  <pre><code>select t.createdTimeStamp FROM ServiceData t , UserInfo C where C.UserId = t.UserId and  CAST(t.createdTimeStamp AS DATE) = '2016-05-30'
  </code></pre>
  
  <p>I tried following in HQL but none worked, (createdTimeStamp  is of datetime datatype in sql server )</p>
  
  <p>Query:</p>
  
  <pre><code>select t.createdTimeStamp FROM ServiceData t , UserInfo C where C.UserId = t.UserId and  CAST(t.createdTimeStamp AS DATE) = '2016-05-30'
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>org.hibernate.QueryException: Could not resolve requested type for CAST : DATE
  </code></pre>
  
  <p>any suggestion on how to make it work would be helpful.</p>