title: How to use distinct in hql
body: <p>I am working on a web application using Hibernate, struts and extjs,
  Here is my scenario.</p>
  
  <pre><code>String hql = "from product";
  </code></pre>
  
  <p>In my product table  three columns are there id, name, section</p>
  
  <p>I need the results based on distinct name of product but i have only option is writing hql no other option is there.</p>
  
  <p>I can use group by but i need the size of the result</p>
  
  <p>so i am using <code>hql.list().get(0);</code></p>
  
  <p>In my code above code is in common method that is every dao uses the same method.</p>
  
  <p>I can use joins but the data is in millions so execution of query is too slow,
  So can any one help how can i write distinct keyword in hql.</p>