title: HQL to query records between two dates
body: <p>I am trying to query all customers records using HQL in my Spring/ Hibernate app that have DateAdded between Date1 and Date2 OR LastSeen between Date1 and Date2, so I've build this HQL query in the Repository/ DAO class:</p>
  
  <pre><code>sessionfactory.getCurrentSession().createQuery("from Customer c where c.dateAdded BETWEEN '"+startDate+"' AND '"+endDate+"' OR c.lastSeenDate BETWEEN  '"+startDate+"' AND '"+endDate+"'").list();
  </code></pre>
  
  <p>I've debugged the app to check the startDate and endDate and found that they are sent as:</p>
  
  <p>startDate: Wed Jan 22 01:16:57 HKT 2014</p>
  
  <p>endDate: Wed Jan 29 01:16:57 HKT 2014</p>
  
  <p>In DB, I am 100% sure there is one record at least meeting this query, as this record DateAdded and LastSeen are as follows:</p>
  
  <p>2014-01-23 15:33:38</p>
  
  <p>2014-01-25 15:33:38</p>
  
  <p>So can someone please tell me what I am doing wrong / missing here?</p>