3 Replies Latest reply on Aug 29, 2007 3:28 PM by Waseem Quraishi

    help needed! error

    Sylvia Trommer Newbie

      Hello @ all...
      I really need some more help :S ...

      I have a class Employee with a function :

      public Set<Project> getProjects() {
       return this.projects;
       }
      


      Now I have another class, in which I have a function with the following code:
      Set<Project> set = user.getProjects();
      SelectItem[] list = new SelectItem[set.size()];
      

      the user is of instance employee and does actually exist, because when I call user.getName() (which is of course another function from employee) , it works fine.
      Now the code above gives an error:

      ERROR [org.hibernate.LazyInitializationException] failed to lazily initialize a collection of role: er.Employee.projects, no session or session was closed
      org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: er.Employee.projects, no session or session was closed
      


      Now as soon as I remove the call to set.size() , I do not get that error anymore.

      Any suggestions?

      Thanks!