Hibernate version: 3.1
There seems to be a bug with Hibernate's approach to dealing with a unidirectional outer join when using a composite pattern.
I have a Composite class, let's call it User, that contains other Users. The table tracks User records across time. So when loading a User row, we wish to also load its subsequent rows. So I would have liked to use fetch="join", like so:
Code:
<union-subclass name="ManagerRow" table="cut_managers" extends="UserRow">
...
<set name="childrenRows" fetch="join" cascade="all">
<key column="id_bk_prev" />
<one-to-many class="UserRow"/>
</set>
However, when doing this, Hibernate give me a lazy initialization exception if the outer join finds no children. Setting lazy="false" does not help.
When I take out the fetch="join" and Hibernate issues separate SQLs for the parent and children, then it all works fine.
Apparently Hibernate sees the null coumns from the outer join as an attempt to access lazy objects loaded in a different session.
Any others find this?