2 Replies Latest reply on Dec 3, 2007 6:05 PM by segev

    Seam-managed persistence context Versus EJB3 persistence con

    segev

      We are conducting a “spike� on Seam 2.0.0.GA (JBoss, Richfaces and hibernate) for a new project.
      We decided to use the Seam-managed persistence context (instead of the EJB3 extended PersistenceContext) for the following reasons:
      The flexibility to inject the context to DAO components (which are not session beans)
      Recommendations in the Seam reference manual 8.3.

      We discovered that for a stateful session beans configured with a scope of “SESSION� the switch from EJB3 extended context (PersistenceContext(type=EXTENDED) to seam injected context @In(value ="entityManager") , we need to define the scope of the injected entity manager to “SESSION� . If we don’t do that, by default it is assigned a “CONVESATION� scope and the stateful session bean does not exhibit the correct transactional behaviour.

      The question is - can we still use the same entity manger component for conversational beans or should we define another entity manager component with the default “Conversation� scope?


        • 1. Re: Seam-managed persistence context Versus EJB3 persistence
          pmuir

          You probably don't want to use a SMPC (conversation scoped) PC in a SESSION scoped SFSB - use an extended PC.

          • 2. Re: Seam-managed persistence context Versus EJB3 persistence
            segev

            We prefer to have a common mechanism for Persistence Context within a project.
            The reasons we think SMPC is a better choice is based on all the points provided in the Seam reference manual section 8.3. There is also a good detailed post in a "ManagedPersistenceContext in Manning JPA book" thread in this forum.

            Is it OK to change the default scope of the SMPC component to session scope?
            Can the above SMPC be used for conversations?

            Any suggestion will be greatly appreciated ;-)