title: In Hibernate, how do I pass in date (without time) as a paramter to a CriteriaQuery?
body: <p>I'm using Hibernate 5.2.12.Final with Java 8.  I'm trying to build a query in which I pass in a date parameter.  However, I only want to pass in the year, month, and day as part of the date param, not the time.  So I have constructed this ...</p>
  
  <pre><code>        final java.sql.Date searchDate = new java.sql.Date(myObjectDate.toDateTimeAtStartOfDay().toDate().getTime());
      final ParameterExpression&lt;Date&gt; d = builder.parameter(Date.class);
  
      query.where(
              builder.greaterThanOrEqualTo(d, objectPlanRoot.&lt;Date&gt;get(MyObject_.startDate)),
              builder.lessThanOrEqualTo(d, objectRoot.&lt;Date&gt;get(MyObject_.endDate))
              );
  
      result = null;
  
              result = entityManager.createQuery(query)
                  .setParameter(d, searchDate)
                  .getSingleResult();
  </code></pre>
  
  <p>However when my query is actually built and run, a time component is getting in the mix.  Through outputting the Hibernate log, I can see this param getting filled in my query ...</p>
  
  <pre><code> '2013-06-30 05:00:00'&gt;=myobject0_.START_DATE and '2013-06-30 05:00:00'&lt;=myobject0_.END_DATE 
  </code></pre>
  
  <p>Notice that there's the "05:00:00" filled in.  How can I eliminate this and only have the date component filled in?</p>