title: Grails - How to get list of distinct User Objects
body: <p>Is there a way that, i can get list of distinct <code>User</code> objects(based on username). And still get result as a List of <code>User</code> Objects rather than, List of username's.</p>
  
  <p>My code is</p>
  
  <pre><code>def criteria = User.createCriteria()
  def users = criteria.list() {
      projections {
          distinct("username")
      }
      setResultTransformer(CriteriaSpecification.ROOT_ENTITY)
  }
  return users
  </code></pre>
  
  <p>Currently am getting List of the usernames, not User.</p>