I have one object (Point) with two one-to-many relationships. When I set lazy="false" for both relationships as below
Code:
<set name="dynamicProps" lazy="false" cascade="all" fetch="subselect">
<key column="POINTID"/>
<one-to-many class="DynamicMap"/>
</set>
<set name="staticProps" lazy="true" cascade="all" fetch="subselect">
<key column="POINTID"/>
<one-to-many class="StaticMap"/>
</set>
and then run this HQL query ("from Point as p") to select all points with this two relationships all works fine, hibernate generates 3 selects.
When I set lazy="true" I can't find a way to write either HQL or to use Criteria object to do exactly the same thing, I mean get all the data in 3 selects.
The reason I need this is because I've got another object Set that has one-to-many relationship with Points, and when I select Set I don't need this properties, only when I select Point.
Does anyone know how to implement fetch="subselect" functionality in HQL or Criteria object to enable/disable lazy="true/false" programaticly
Thanks