1 Reply Latest reply on Aug 21, 2002 12:51 PM by Adrian Brock

    Transaction between two session bean

    Roger Newbie

      Hi everybody

      I'm testing JBOSS with two Stateless Session Bean having transaction-type Bean managed.
      The target of the test is to obtain only one transaction for the two Session Bean using UserTransaction
      The first Session Bean has the following method:
      - Get UserTransaction u
      - u.begin()
      - insert a row in Oracle table A
      - call a method of the second Session Bean
      - u.rollback().
      The method of the second Session Bean insert a row in Oracle table B

      The result of the test:
      - The insert operations on table A is rollbacked
      - The insert operations on table B is commited.
      I expect rollback for both the operation.
      Instead the method in the second Bean is running in one new transaction (only the operation in the first session Bean are rollbacked).
      Where is the mistake ?
      How to obtain the same transaction using Stateless Session Bean with transaction-type Bean ?


      Onother question:
      When I use transaction-type Container with trans

        • 1. Re: Transaction between two session bean
          Adrian Brock Master

          BMT doesn't work this way.

          The container will suspend the current transaction before
          invoking the method on your BMT Bean.

          By definition the container cannot provide a BMT Bean
          with a transaction, it creates its own.
          One exception to this rule is where a stateful session
          exits a method without committing. The next invocation
          on the stateful session will be with the uncommitted transaction.
          Its all in the spec.

          You must use CMT for entity beans.

          Regards,
          Adrian