2 Replies Latest reply on Mar 4, 2007 4:19 PM by jlessner

    Self-destroying a stateful session bean

    jlessner

      Does anybody know if there is a way how a stateful session bean can destroy itself without rolling back the current transaction? The only idea I had was to call the bean's own remove-method - of course not directly but through the proxy by SessionContext.getEJBObject(). Unfortunately this caused the remove-method of a completely new bean instance to be called. So this is no solution.

      Regards,
      Jan

        • 1. Re: Self-destroying a stateful session bean
          weston.price

          No, as the transaction is tied to the SFSB instance. Any work registered and done by that instance has to be rolled back for integrity; the only way to do this and maintain integrity is to roll back the entire transaction.

          • 2. Re: Self-destroying a stateful session bean
            jlessner

            I'm not sure if this is generally true. If an SFSB's remove-method is called, the instance is destroyed but the transaction which the remove-method runs in, is *not* rolled back. So in general there is a way.

            "weston.price@jboss.com" wrote:
            No, as the transaction is tied to the SFSB instance. Any work registered and done by that instance has to be rolled back for integrity; the only way to do this and maintain integrity is to roll back the entire transaction.