6 Replies Latest reply on Oct 16, 2002 9:44 AM by adrian.brock

    CMP & CMT: can't create new transaction ctx when calling fro

    soeiro

      I have the following setup in a SessionBean

      void A()
      {
      //Make many things that don't require a transaction
      //Loop
      while(x)
      {
      //Call B, createing a new transaction everytime
      B();
      }
      }

      void B()
      {
      //Do some stuff that must be inside a transaction
      //Get a Collection from an entity bean (CMR result)
      //Get java.lang.IllegalStateException: A CMR collection may only be used within the transction in which it was created
      }

      Method A's CMT transaction is declared as NotSupported. Method B's CMT transaction is declared as Required.

      It isn't working. When I look at the TRACE results it is clear that upon entering method B no new transaction is created (there should be, because the calling method doesn't have a transaction context).

      Does anybody know if CMT does not allow one to enter and leave transaction contexts when calling methods in the same class? My guess is that it seems to work only when the called method is in another bean. Well, it seems to be logical, too. How would the application server know that an internal method is been called by another internal method?

      Thanks in advance for any help,

      Luís JB Soeiro