4 Replies Latest reply on Jan 3, 2008 6:42 AM by pmuir

    Propagation of Persistence Context in Seam

    breako

      Hi,
      If Seam managed EntityManagers are being used, the Persistence Context propagates between the EntityManagers that are in the same conversation. This is very good and useful.

      I am just wondering if another component, for example an EJB is using an EntityManager in the same transaction as a Seam Component which has a Seam managed EntityManager, would the Persistence Context propagate. I doubt it. but just want to make sure that it is correct to say:
      "Seam only propagates persistence contexts between Seam managed EntityManagers used in the same web request?"

        • 1. Re: Propagation of Persistence Context in Seam
          breako

           

          "breako" wrote:
          Hi,
          If Seam managed EntityManagers are being used, the Persistence Context propagates between the EntityManagers that are in the same conversation. This is very good and useful.

          I am just wondering if another component, for example an EJB is using an EntityManager in the same transaction as a Seam Component which has a Seam managed EntityManager, would the Persistence Context propagate. I doubt it. but just want to make sure that it is correct to say:
          "Seam only propagates persistence contexts between Seam managed EntityManagers used in the same web request?"

          Or to put this question another way, what is the scope of the propagation of the persistence context? How does seam know how far to propagate it?

          • 2. Re: Propagation of Persistence Context in Seam
            pmuir

            The scope is conversation. The same Persistence Context will injected by @In (or via programmatic lookup) during the lifetime of that conversation. If you inject via @PersistenceContext, it isn't a SMPC.

            • 3. Re: Propagation of Persistence Context in Seam
              breako

               

              "pete.muir@jboss.org" wrote:
              The scope is conversation. The same Persistence Context will injected by @In (or via programmatic lookup) during the lifetime of that conversation. If you inject via @PersistenceContext, it isn't a SMPC.

              Thanks for that.
              Just to confirm, there is no way to propagate a persistence context between a SMPC and one not managed by Seam.

              I am nearly certain that is the case, just want to be sure.


              • 4. Re: Propagation of Persistence Context in Seam
                pmuir

                Not afaik.