3 Replies Latest reply on Jul 26, 2007 1:31 PM by wayne baylor

    org.hibernate.LazyInitializationException

    v ck Newbie

      guys, am facing an issue while trying to lazy load certain entities withing a multithreaded enviornment.

      here s my scenario :

      Class Outer {

      //Am using jboss rules session
      private rulesSession;

      private class Inner implements Runnable {

      run() {

      }

      private lazyLoadEntites() {
      // this is where I get the damn exception

      }

      private assertToSession() {
      rulesSession.assert(something);
      }
      }


      method() {
      // this creates multiple threads to do some job in parallel
      // am using executors, and am executing run() of inner class
      }
      }


      and here s my exception

      13:50:48,462 ERROR [LazyInitializationException] failed to lazily initialize a collection of role:no session or session was closed
      org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: no session or session was closed
      at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
      at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:3

      at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)


      F1 please!!