http://www.hibernate.org/117.html#A12 emphasizes that 'some people actually want this' with the 'this' referring to the duplicate references Hibernate generates when marshalling the SQL outer join results to the objects.
Of course, many have hit this problem (e.g.
http://forum.hibernate.org/viewtopic.ph ... duplicates). I think this violates the very philosophy of an ORM layer -- the SQL outer join correctly returns duplicate records but, when the results are logically marshalled into objects, these SQL outer join artifacts should not be retained. Even an HQL outer join has object-level semantics that shouldn't be tied to the SQL outer join implementation. If one were creating an ORM layer manually using ADO.Net, one would never duplicate the references -- we would perform the outer join using SQL and then process the results without any trace of the SQL artifacts (such as the SQL outer join duplication).
The decision to duplicate references is not well understood by me -- does anyone have a good ORM reason for why this should be left as it is?
We're experiencing the same problems as the above forum post (we don't have the root that has duplicate references but, instead, a nested class that has them).
Comments?
Thanks --