title: Select distinct entities by specific column
body: <p>I have a table with 4 columns : id, column_a and column_b</p>
  
  <p>My initial query is basicaly </p>
  
  <pre><code>Session session = initialize my hibernate session;
  Criteria criteria = session.createCriteria(MytableBean.class);
  // add some constraints
  return criteria.list()
  </code></pre>
  
  <p>And it returns some results like :</p>
  
  <pre><code>id  |  column_a  | column_b | 
  1   |  A         | 1        | 
  2   |  A         | 1        | 
  3   |  A         | 2        | 
  4   |  B         | 3        | 
  5   |  B         | 3        | 
  </code></pre>
  
  <p>But I don't want to get several times the same couple (column_a, column_b), even if I need to have it many times in my database.</p>
  
  <p>So, I'm looking for a query which returns a result similar to:</p>
  
  <pre><code>id  |  column_a  | column_b | 
      |  A         | 1        | 
      |  A         | 2        | 
      |  B         | 3        | 
  </code></pre>
  
  <p>In sql I would use <code>SELECT DISTINCT column_a, column_b FROM ....</code></p>
  
  <p>But I can't use sql (and either don't want to use hql, as far as possible).</p>