Easy learning with example program codes

eager loading in hibernate

Hibernate provides the facility of parent child relationship between entities. There may be the case when one parent record can have multiple child records. By default, in hibernate all its child records are fetched when a parent record is fetched. This is known as eager loading in java.

In the below example all subjects are fetched whenever a student object is fetched.

<list name="subjects" cascade="all" >
     <key column="Student_Id"/>
     <list-index column="idx"/>
     <one-to-many class=""/>
Sign Up/ Sign In
Ask a Question

Copyright © 2018 CodesJava Protection Status SiteMap Reference: Java Wiki