wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Hibernate - lazy vs. eager loading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate - lazy vs. eager loading" Watch "Hibernate - lazy vs. eager loading" New topic
Author

Hibernate - lazy vs. eager loading

Rish Pan
Greenhorn

Joined: Apr 15, 2005
Posts: 3
Hey all--

I'm new to this forum (and actually to JavaRanch in general)! Any best practices/etiquette advice is always welcome.

My group is using Hibernate for our current project. This is my first time using the tool and I have some questions regarding lazy vs. eager loading.

In the hbm files, there is a 'lazy' attribute which allows one to specify if a related collection should be eagerly loaded or not. There is also a 'batch-size' attribute which defaults to 1. How is this attribute used?

Thanks,
RishPan
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
lazy=true improves performance: if some class has a bag/set, their elements are loaded only after you make an explicit call to MyObject.mySet

but hibernate site explains it here and here

i'd recommend you browse hibernate docs (they come with download): quite an excelent aid!


java amateur
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate - lazy vs. eager loading
 
Similar Threads
Named query to override eager fetching
How does Hibernate get child objects
Spring JDBC Vs Hibernate?
Hibernate returns List with NULL
lazy loading