File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes LazyInitializationException Help please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "LazyInitializationException Help please" Watch "LazyInitializationException Help please" New topic
Author

LazyInitializationException Help please

Milan Djukic
Greenhorn

Joined: Feb 14, 2011
Posts: 27
Hi all.

Please help me, this is killing me

I have two classes A and B.





And when i call find method of class EntityManager find(A.class,id) i get a org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: ......

How can i solve this, this is really killing me



kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1383
change lazy to eager fetching strategy.
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1383
Make sure Hibernate session is used after session is closed
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: LazyInitializationException Help please