2 Replies Latest reply on May 5, 2009 7:38 PM by Arbi Sookazian

    Behaviour of entityManager after Passivation

    Duncan Stockdill Newbie

      After passivation of a SFSB in a long running conversation, should the entityManager be reinjected as it was on activation?  I'm having trouble with objects becoming disconnected after passivation/activation.  So flush and lazy load no longer work.

      I'm using Seam 2.1.0 SP1, SMPC and JPA(Hibernate)

      cut down example:

      public class ExampleControllerBean implements ExampleControllerLocal,  Serializable
      private EntityManager entityManager;
      @Out(required = false)
      private ExampleEntity currentExampleEntity;
      @Begin(flushMode=FlushModeType.MANUAL, join=true) 
      public void init() {
         [load currentExampleEntity if not already loaded...]
      public void save() {

      prior to passivation the save works fine.  after passivation the user's changes are lost because they don't get flushed (i.e. object is detached).

        • 1. Re: Behaviour of entityManager after Passivation
          Duncan Stockdill Newbie

          after lots more googling I've partially answered my own question. 

          Seam 2 introduced ManagedEntityIdentityInterceptor which was intended to resolve the
          detached entities problem:

          ManagedEntityIdentityInterceptor has been disabled by default in Seam 2.1

          JBSeam-2209 is marked as resolved for 2.1.1.  Does this mean MEII is now safe to use in 2.1.1?  Are there performance considerations?  Is the problem with nested conversations resolved?  The notes in JBSeam-2209 don't make it clear.

          • 2. Re: Behaviour of entityManager after Passivation
            Arbi Sookazian Master

            JSR 220:

            A container must not passivate a stateful session bean with an extended persistence context unless the
            following conditions are met:
            • All the entities in the persistence context are serializable.
            • The EntityManager is serializable.

            The session bean class is not required to implement the SessionBean interface or the Serializable