1 Reply Latest reply on Jul 16, 2002 7:26 AM by Sergei Batiuk

    CMP and Transactions

    Sergei Batiuk Newbie

      Hello,

      I have four EJBs: Sequence (CMP ) and SequenceGenerator (Stateless Session), that are responsible for generating a primary key, in a separate ejb-jar, and two other (both CMP) - TreeNode and Group - in the other ejb-jar. All the transaction flags for all methods in all interfaces are set to REQUIRED. I am using Microsoft SQL Server 2000 as a database and Atinav JDBC driver.

      I am attempting to perform these operations:
      1. Get next sequence value for Group.
      2. Create a Group.
      3. Get next sequence value for TreeNode.
      4. Create a TreeNode.

      Now when I try to call bean's methods, that span all mentioned CMP's, using MS SQL Server Profiler tool I can see that instead of a single transaction spanning all involved EJBs, JBoss performs four separate transactions. SequenceGenerator's methods are called from within ejbCreate() of both TreeNode and Group , so they definitely should be in the same 'transaction context' as TreeNode and Group.

      Could please anybody tell me what's wrong?

      Thanks in advance,
      Sergei Batiuk.

        • 1. Re: CMP and Transactions
          Sergei Batiuk Newbie

          I have just created a stateless session bean and wrapped all the logic into one method. Everything works well now, all operations within a single transaction. Before that, I made two separate calls to entity beans ( Tree and Group ) from a client (applet), which probably could give no idea to the container where transaction boundaries are.

          I still am confused, however, with the fact that a call to entity bean's ejbCreate() which in turn called another bean's method, with transaction flags set as 'Required', resulted in two separate transactions.

          Sincerely,
          Sergei Batiuk.