3 Replies Latest reply on Dec 29, 2009 1:13 PM by blabno

    lazy loading exception

    aymenez

      Hello,
      I have a lazyloading exception in the render phase of seam. I make my persistentContext extended and the problem was fixed. but my real problem is that i had to change my bean to stateful to use the persistentContextType as Extended.
      It is not logic to make my bean stateful because it is a simple request and response.
      so can i keep my bean stateless and avoid this lazyloadexception? i want the persistentContext live until the page is rendered.





        • 1. Re: lazy loading exception
          blabno

          If you are not using seam managed persistent context then no way. You always can load assotiations in your stateless bean.

          • 2. Re: lazy loading exception
            aymenez

            Hello,
            what do you mean by seam managed persistent context? you mean that i must not use the persistent Context injected by JBOSSAS, you mean i use POJO and not EJBs?


            I am sorry, I do not undersand You always can load assotiations in your stateless bean, how?

            • 3. Re: lazy loading exception
              blabno

              Standard EJB have @PersistenceContext annotation which injects EntityManager from application server. Seam creates it's own EntityManager and can inject it for you via @In annotation. To use SMPC you must setup in in components.xml. It is described in reference manual. If you have configured it as entityMasta then in your code :


              @In
              EntityManager entityMasta;
              



              Loading lazy associations : iterate over collection holding that association.