Join Fetching: In Join Fetching Hibernate fetches the associated instance and its collection in a single select using OUTER JOIN. If join fetching is enabled then lazy fetching should be disabled, instead fetch retrieves all the associations and collections associated with the instance.
<set name="permissions" fetch="join" >
<key column="pId"/>
<one-to-many class="Permissions"/>
</set>
<set name="permissions" fetch="select" >
<key column="pId"/>
<one-to-many class="Permissions"/>
</set>
<set name="permissions" fetch="join" >
<key column="pId"/>
<one-to-many class="Permissions"/>
</set>
Fig: Join Fetch ( Click on the image to see clearly) |
Select Fetching: In Select Fetching Hibernate fetches only the parent instance and lazily load the collections and associations.Lazy loading should be enabled and it doesn't allow immediate fetching.
Fig: Select Fetch(Click on image to see clearly) |
<key column="pId"/>
<one-to-many class="Permissions"/>
</set>
Batch Fetch: In Batch Fetching Hibernate fetches set of instances and its associations by specifying list primary or foreign keys.
<class name="ProjectSpecification">
<set name="permissions" batch-size="10">
<------------>
</set>
</class>
Vissu