As we know that hibernate supports inheritance which means records with parent child relationship. Consider the situation when one parent have multiple child records. In this case hibernate can lazy load all children, actually it will not load all children records when loading the parent. Hibernate will load all child records automatically on demand i.e. when accessed.
It is used to increase the performance.
By default lazy=”false” and all child records are loaded with parent. We can use lazy=”true” to support lazy loading.
<list name="subjects" cascade="all" lazy=”true”> <key column="Student_Id"/> <list-index column="idx"/> <one-to-many class="com.w3spoint.business.Subject"/> </list>