title: Date query with Hibernate on Timestamp Column in PostgreSQL
body: <p>A table has timestamp column. A sample value in that could be 2010-03-30 13:42:42. With Hibernate, I am doing a range query Restrictions.between("column-name", fromDate, toDate).</p>
  
  <p>The Hibernate mapping for this column is as follows.</p>
  
  <pre><code>&lt;property name="orderTimestamp"  column="order_timestamp" type="java.util.Date" /&gt;
  </code></pre>
  
  <p>Let's say, I want to find out all the records that have the date 30th March 2010 and 31st March 2010. A range query on this field is done as follows.</p>
  
  <pre><code>Date fromDate = new SimpleDateFormat("yyyy-MM-dd").parse("2010-03-30");
  Date toDate = new SimpleDateFormat("yyyy-MM-dd").parse("2008-03-31");
  Expression.between("orderTimestamp", fromDate, toDate);
  </code></pre>
  
  <p>This doesn't work.</p>
  
  <p>The query is converted to respective timestamps as "2010-03-30 00:00:00" and "2010-03-31 00:00:00". So, all the records for the 31st March 2010 are ignored.</p>
  
  <p>A simple solution to this problem could be to have the end date as "2010-03-31 23:59:59." But, I would like to know if there is way to match only the date part of the timestamp column.</p>
  
  <p>Also, is <code>Expression.between()</code> inclusive of both limits? Documentation doesn't throw any light on this.</p>