• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate - lazy vs. eager loading

 
Rish Pan
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1281
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic