3 Replies Latest reply on Jul 31, 2009 12:33 AM by asookazian

    Seam Managed Persistence Context

    sebastiendeg.sebastien.degardin.gmail.com

      Hi there,


      I'm  reading the manual, however, I'd like to have a confirmation for the difference between Seam Managed Persistence Context and Extended EJB Container Managed Persistence Context.


      If I have a Conversation Scoped SFSB with a Persistence Context, there is no difference if i Use Extended Container Managed Persistence Context or Seam Conversation Scoped Persistence Context.


      The difference is when a Call different Component like SFSB or SLSB during the Conversation, in that case, Seam provide me the right persistence context ? right ? (in that case, the EJB container will provide me different Persistence Context) ?

        • 1. Re: Seam Managed Persistence Context
          christian.bauer

          Sebastien Degardin wrote on Jan 23, 2008 01:01 AM:


          The difference is when a Call different Component like SFSB or SLSB during the Conversation, in that case, Seam provide me the right persistence context ? right ? (in that case, the EJB container will provide me different Persistence Context) ?


          Yes. Although replace EJB container will with EJB container might under certain circumstances which are explained in the spec (obscure) and certain books (clear).

          • 2. Re: Seam Managed Persistence Context
            sebastiendeg.sebastien.degardin.gmail.com

            ok, thanks for that.


            I'm going to read about that EJB Container Managed Persistence Context.


            Tks

            • 3. Re: Seam Managed Persistence Context
              asookazian

              Sebastien Degardin wrote on Jan 23, 2008 01:01:

              If I have a Conversation Scoped SFSB with a Persistence Context, there is no difference if i Use Extended Container Managed Persistence Context or Seam Conversation Scoped Persistence Context.


              The above statement is not true.


              This:


              @PersistenceContext(type=PersistenceContextType.EXTENDED)
              EntityManager entityManager;



              is not the same as this:


              @In
              EntityManager entityManager;



              The PC is scoped to the life of the SFSB whereas the SMPC is conversation-scoped:


              @Scope(ScopeType.CONVERSATION)
              @BypassInterceptors
              @Install(false)
              public class ManagedPersistenceContext implements Serializable, HttpSessionActivationListener, Mutable, PersistenceContextManager, Synchronization
              {...}



              Also, you cannot use Hibernate manual flush without SMPC (it's not part of JSR220 and thus not usable in @PersistenceContext).  So if you only have one SFSB in your use case implementation then maybe it's true they're sort of the same (b/c the same SMPC can be used in multiple components in a LRC but it doesn't apply if there is only one SFSB) but technically ejb-managed PC and SMPC are not the same.