0 Replies Latest reply on Jun 16, 2007 3:03 PM by Ignacio de Cordoba

    LazyInitializationException in PostLoad method

    Ignacio de Cordoba Novice

      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,