3 Replies Latest reply on Aug 16, 2002 12:35 AM by Dain Sundstrom

    Transaction between two session bean

    Roger Newbie

      Hi everybody
      I'm testing JBOSS with two Stateless Session Bean with transaction-type Bean managed.
      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.
      Where is the mistake ?

        • 1. Re: Transaction between two session bean
          Dain Sundstrom Master

          I don't know. There really isn't enought information here to help you. I suggest you take a close look at your transaction attributes in the ejb-jar.xml file.

          • 2. Re: Transaction between two session bean
            Roger Newbie

            Other information :
            - Jboss 3.01RC1
            - JDK 1.3.1_02
            - ejb-jar.xml (see attachment)
            - oracle-service.xml is the standard file (from docs/examples/jca)
            - jdbc oracle is classes12.zip (the last from oracle technet)

            In the ejb-jar:
            - session-type is Stateless
            - transaction-type is Bean

            The target of the test is to obtain only one transaction for the two Session Bean using UserTransaction
            Instead the method in the second Bean is running in one new transaction (only the operation in the first session Bean are rollbacked).
            How to obtain the same transaction using Stateless Session Bean with transaction-type Bean ?

            Onother question:
            When I use transaction-type Container with trans-attribute Required the result is correct.
            But if the transaction time exceedes the transaction timeout, how to catch this Exception from code ?



            • 3. Re: Transaction between two session bean
              Dain Sundstrom Master

              I suggest you ask this in the EJB forum.