2 Replies Latest reply on Jan 2, 2008 5:56 AM by Pete Muir

    Lazy loading exception with Seam EM

    asaf sh Expert


      I have a very simple authenticate component as in all seam examples such:

      EntityManager entityManager;
      @Out(required=false, scope = SESSION)
      User loggedUser;
      public boolean authenticate() {
      //load the user from db and set it into 'loggedUser' var
      Well it works fine, the loggedUser object is being outjected to the session, the problem is that when I touch the collections of the 'loggedUser' entity (that are fetched lazily) I get lazy collection exceptions,
      shouldn't any entity loaded by Seam's EM has to being in managed state for the whole user session (as long as I'm always using Seam's EM of course) ?