title: Criteria Restriction by date field
body: <p>I have 2 tables, <code>Partner</code> and <code>Visit</code>. A partner can have many visits, also various in same day.
  I need to create a <code>Criteria</code> restriction to know how many <strong>days</strong> the <code>Partner</code> has visits since a given date. So, 2 or more visits in same date must be only one.</p>
  <p>Can this be done only by <code>Criteria</code> and <code>Restrictions</code>??</p>
  <p>I can get all visits from a date with a criteria like:</p>
  <pre><code>Criteria criteria = buildCriteria();
  criteria.add(Restrictions.eq(DBConstants.VISIT_COL_VISITOR, partnerVisitor));
  criteria.add(Restrictions.ge(DBConstants.VISIT_COL_DATE, startDate));
  </code></pre>
  <p>But now, to filter repeated days, I need something like:</p>
  <pre><code>criteria.add(Restrictions.unique(DBConstants.VISIT_COL_DATE));
  </code></pre>
  <p>Any idea?</p>
  <p><em><strong>EDIT:</strong></em> @user23123412 @netik</p>
  <pre><code>Visit.java
  
  private Integer id;
  private Date date;
  private Partner visitor;
  
  // getters + setters
  </code></pre>
  <p><code>Visit</code> table rows related to partner 1:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>ID</th>
  <th>VISITOR</th>
  <th>DATE</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>1</td>
  <td>10/10/2014 16:20</td>
  </tr>
  <tr>
  <td>20</td>
  <td>1</td>
  <td>10/10/2014 18:00</td>
  </tr>
  <tr>
  <td>45</td>
  <td>1</td>
  <td>12/10/2014 16:20</td>
  </tr>
  <tr>
  <td>71</td>
  <td>1</td>
  <td>12/10/2014 19:40</td>
  </tr>
  <tr>
  <td>89</td>
  <td>1</td>
  <td>16/10/2014 11:20</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>The answer I need after the query is a <code>Visit</code> count in <strong>different days</strong> since a given <code>date</code>.</p>
  <p>I.E.: If i launch a query with <code>visitor = 1</code> and <code>startDate = 12/10/2014</code> the result <strong>MUST</strong> be 2, cause row <code>id = 45</code> and <code>id = 71</code> have different visits in a same day, so it's only ONE day.</p>