2 Replies Latest reply on Apr 19, 2012 11:51 AM by hantsy

    Lazy exception in session scoped bean...

    hantsy

      There is a user object, after user loggined, prodcues a Session scoped user object, the user has List relation, but when I <ui:repeat > to iterate the list,

       

      I got a lazy exception. I think the session scoped bean would detached when it is in  a request .

       

      It seems the @conversionScoped @ExtensionManaged entitymanager only can ensure the conversation scope worked well.

       

      How to avoid this exception?

        • 1. Re: Lazy exception in session scoped bean...
          clerum

          The entityManager used to create the User bean is only going to last for the conversation and thus likely will be gone after login (depending on your configuration)

           

          The way to handle this is to tigger the load of the lasy collection during the login process so that the list is populated before the entity gets detached.

           

          user.getMyThings().size();

          • 2. Re: Lazy exception in session scoped bean...
            hantsy

            I understand your meaning...it is a ugly soluition...

             

            Now I used @Produces to generate another List bean for it directly to overcome the problem