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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
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
 
 
subject: Use of Hibernate.initialize() when lazy loading is configured