Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Object Relational Mapping and the fly likes Use of Hibernate.initialize() when lazy loading is configured Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "Use of Hibernate.initialize() when lazy loading is configured" Watch "Use of Hibernate.initialize() when lazy loading is configured" New topic
Author

Use of Hibernate.initialize() when lazy loading is configured

tanu dua
Ranch Hand

Joined: Apr 05, 2004
Posts: 145
Hi ,

I know to avoid LazyIniializationException we do Hibernate.initialize(Object obj) so tht object that is passed as argument to initialize() method is initialized and can be used outside of the scope of the session .

But what I am not able to understand how this works . I mean if we are doing then we end up in having eager fetching so why we did lazy in the configuration and end up in the eager fetching while runtime.

Am I missing something ??

Thanks
Tanu
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Use of Hibernate.initialize() when lazy loading is configured
 
Similar Threads
what are the disadvantage of Lazy and eager fetching??
fetching.lazy
[Hibernate] about loading associations
annotation for lazy loading
LazyInitializationException Help please