[jboss-user] [EJB 3.0] - LazyInitializationException in PostLoad method

icordoba do-not-reply at jboss.com
Sat Jun 16 15:03:02 EDT 2007


Hi,
I am getting the following exception when trying to get the size of a one to many relation in a PostLoad method. Of course, this code runs inside a SLSB DAO and should so be inside a transaction:
org.hibernate.LazyInitializationException: failed to lazily initialize a collection, no session or session was closed
  |         at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
  |         at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
  |         at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
  |         at org.hibernate.collection.PersistentSet.size(PersistentSet.java:139)
  |         at com.servengine.contentmanager.CMCategory.postLoad(CMCategory.java:52)

I am using Set as the type for the relation and have set Eager load. How am i suppoused to access EJB CMRs from callback methods lik PostLoad?

Thanks for any help,
Ignacio
 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4054980#4054980

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4054980



More information about the jboss-user mailing list