4 Replies Latest reply on Mar 19, 2013 3:13 AM by fihu

    EJB 2.1 - transactions

    fihu Newbie

      Today I've run into some weird scenario - maybe someone could explain it to me.

       

      Background:

       

       


      SLSB - ASLSB - BEntity Bean with CMR - E
      Transaction attribute declared per classSupportsSupportsSupports

      Transaction attribute declared per method

      Not supportedRequired---

      calls method from bean B

      retrieves information from database using entity bean

       

      Jboss EAP 6.0.1

       

       

      Problem:

      When I run this code on jobss 5 and weblogic it runs just fine, but when I try with jboss 7 I get an exception in method from bean B - "A CMR collection may only be used within the transaction in which it was created". So I investigated the whole situation and it occurred that even though the transaction attribute for beans B method is "required" there was no transaction inside it. When I change transaction type to "RequiresNew" everything worked fine.

       

      1. Am I getting transactions type mixed up or is it a bug in jboss?

      2.  Is it necessary to open a transaction to retrieve entity bean (one that uses CMR) from database?