title: Duplicates using left join fetch
body: <p>I'm using a HQL query to obtain certain records. If I use <code>LEFT JOIN FETCH</code> a collection which is in my target entity will contain duplicate records. If I only use left join, it won't. I guess when Hibernate lazily loads the records, it avoids duplicates.</p>
  
  <pre><code>"SELECT z FROM ", TableA.TABLE_NAME, " z ",  //
              "LEFT JOIN FETCH z.attributeX pv ", //
              "LEFT JOIN FETCH pv.attributeY anteil ", //
              "LEFT JOIN FETCH z.attributeB kma ", //
              "LEFT JOIN FETCH kma.attributeC ", //
              "WHERE anteil.attributeD.attributeE.id = :eId ", //
              "AND pv.attributeG.id = :gId ");
  </code></pre>
  
  <p>My entity <code>TableA</code> has a link to to <code>TablePV</code> (<code>LEFT JOIN FETCH z.attributeX pv</code>)</p>
  
  <p><code>TablePV</code> has a collection of <code>TableY</code> (<code>LEFT JOIN FETCH pv.attributeY anteil</code>)</p>
  
  <p>Now Hibernate will map everything correctly except for the children of <code>TablePV</code>. It will contain several times the same record. A distinct on <code>TableA</code> doesn't help, since there are no duplicates there. I could manually remove those records which would be quite nonperforming I guess.</p>