title: hibernate - query return type
body: <p>I have a (relatively) simple HQL query that returns two joined entities, that have a one-to-many relation.
  As a result of the query, I want to obtain a list of type entity1, where entity1.entity2 is mapped.
  Because I get a cartesian product in the result set, where for every entity2 (the many side) I have 1 row, I get duplicates of entity1.
  Thus, if I list() the result, I get duplicate entries.</p>
  
  <p>To resolve this problem, I use <code>query.setResultTransformer( Criteria.DISTINCT_ROOT_ENTITY );</code> </p>
  
  <p>However, this does not always return a list of rntity1, but sometimes a list of entity2.  </p>
  
  <p>Is there a way to specify the "main" entity of the ResultSet?</p>