wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes failed to lazily initialize a collection of role hibernate3 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 "failed to lazily initialize a collection of role hibernate3" Watch "failed to lazily initialize a collection of role hibernate3" New topic
Author

failed to lazily initialize a collection of role hibernate3

vani venkat
Ranch Hand

Joined: Nov 21, 2006
Posts: 142
hi
I have one to one mapping between three objects.
Job --> salesRole --> positionTemplate.

I am getting this "failed to lazily initialize a collection of role" error with hibernate 3. i tried to use lazy="false" to force hibernate to load eagerly.
still i get the same error when i try to access position template fields. Here are my hibernate mapping files.
job.hbm.xml


SalesRole.hbm.xml

position template.hbm.xml


Can some one please point out the problem. here is how i am loading Job object.



i tried to use http://today.java.net/pub/a/today/2005/10/11/testing-hibernate-mapping.html?page=last not to load beans lazily. the commented code in above method shows that. that gives the same problem. I have been trying to figure it out for the past two days. appreciate any kind of help regarding this.
thanks


SCJP 1.4, SCWCD 1.5
vani venkat
Ranch Hand

Joined: Nov 21, 2006
Posts: 142
hi,
i am retrieving all this information in a DTO, and then comitting the transaction. can some one point out what else is wrong here?
thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: failed to lazily initialize a collection of role hibernate3
 
Similar Threads
one to one mapping in hibernate..exception while saving.
What causes Hiberante to issue a SQL update command
Hibernate : many to many mapping and inner join query results.
Hibernate, User and Address with association table between
Hibernate - multiple collection with restrictions mapping problem