Home » Hibernate Lazy Collection

Hibernate Lazy Collection

by Online Tutorials Library

Hibernate Lazy Collection

Lazy collection loads the child objects on demand, it is used to improve performance. Since Hibernate 3.0, lazy collection is enabled by default.

To use lazy collection, you may optionally use lazy=”true” attribute in your collection. It is by default true, so you don’t need to do this. If you set it to false, all the child objects will be loaded initially which will decrease performance in case of big data.

Let’s see the hibernate mapping file where we have used lazy=”true” attribute.

Next TopicComponent Mapping

You may also like