0 Replies Latest reply on Oct 1, 2002 12:39 PM by Mark Ralph

    stateful session bean that retains transaction context

    Mark Ralph Newbie


      I am using Tyrex with JBoss-2.4.4 and it works fine out of the box.
      I am however having a design issue and would appreciate some advice.

      I am using a stateful session bean with bean managed transactions.
      This is so the bean can hold several updates - and then commit them all at once.

      At first i tried having the stateful bean use the transaction manager to retrieve the Transaction associated with the bean - but this would return null on subsequent invocations of the bean methods. I think this is as the transaction manager is using ThreadContext to retrieve the Transactions, and different threads may servicing the requests on the bean.

      I considered holding the Transaction in the bean as state - but got problems on passivation due to Transactions being unserialisable.

      Do i need to stringify the transaction id and store this in the bean ? Doesn't get away from the standard JTA and forces me to use the TyrexTransactionManager interface instead.

      Any ideas how I can best retrieve the transaction associated with the bean ?

      Futhermore - will this still work in a clustered environment ?