This content has been marked as final.
Show 2 replies
-
1. Re: failed to lazily initialize a collection of role: ... .T
ejimenez Feb 11, 2006 1:28 AM (in response to mehmetbilgi)Are you using EJBs?
I've found this when I've passed an object across classloader boundaries (EJBs in different EARs in a container) and then try to access an association within the object. The Hibernate proxy object no longer holds the information necessary to lazily load the associated class. Either turn off lazy loading (not generally recommended) or don't retrieve the association, run the query again. -
2. Re: failed to lazily initialize a collection of role: ... .T
adochiny May 11, 2007 10:32 AM (in response to mehmetbilgi)You need to add parameter "fetch = FetchType.EAGER" to your one-to-many relationship which returns a collection, and write code similar to the following in your session bean.
Cruise cruise = manager.find(Cruise.class, cruiseID);
return cruise.getReservations();
Hope this will help
Regsrds
Adonis Mhlanga