2 Replies Latest reply on May 11, 2007 10:32 AM by adochiny

    failed to lazily initialize a collection of role: ... .Task.

    mehmetbilgi

      Hi,
      the problem is :
      14:27:13,671 ERROR LazyInitializationException : failed to lazily initialize a collection of role: org.jbpm.taskmgmt.def.Task.events - no session or session was closed
      i got this exception while trying to run WebsaleTest, that comes with the framework.. Firstly, it printed it can not find taskinstance class, than i placed: jbpm.task.instance.class=org.jbpm.taskmgmt.exe.TaskInstance line in jbpm.properties . that is weird because i should not write the default task instance class, it already knows that. Whatever, after that, i got the LazyInitializationException . did anyone seen this before ?

      Thanks in advance.

      Mehmet Bilgi

        • 1. Re: failed to lazily initialize a collection of role: ... .T
          ejimenez

          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

            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