0 Replies Latest reply on May 8, 2010 1:37 AM by Arbi Sookazian

    When does the @Destroy method get invoked?

    Arbi Sookazian Master

      Assume you have an active LRC started by a different Seam component.  Then we have the following backing bean that does not explicitly join a conversation (i.e. no @Begin(join=true).

      public class FooUIBean implements FooUI {
          @PersistenceContext(unitName = PersistenceConstants.PERSISTENCE_UNIT_NAME, type = PersistenceContextType.EXTENDED)
          private EntityManager em;
          public void submit() {}
          @Destroy @Remove
          public void destroy ()

      And you may assume we're using SMPC alternatively (which is extended PC as well).  I'm not sure that's relevant but we'll see (currently we are using Java EE extended PC via @PersistenceContext).

      The destroy() method above is not being invoked after interface method invocations.  I was expecting it to be invoked as I assume that this is bound to a temp conversation, not a LRC.

      The default scope is conversation scope.

      So why is the @Destroy method not being invoked when I exec test cases that invoke the submit() method for example?  When does this component get destroyed by the Seam container (and I'm not concerned with EJB container destruction due to passivation, etc.)

      and how do you know during runtime the scope a Seam component is bound to?  I'm not sure if the Seam debug page provides that info or not...