2 Replies Latest reply on Nov 3, 2005 4:37 PM by sheida sadrai

    CMP and Transactions

    Dani Belz Newbie

      Hi, I have a question according to transaction management in CMP where I cannot find an answer (maybe because I don't know what I should look for) but maybe you can help me to understand...

      I have a session bean A with "Requires New". This creates a new database entry for entity bean B that has "Required". Then session bean A calls session bean B (also with "Required") which in in turn calls another instance of entity bean B to find the entry that was made above.

      Here is some pseudo code:

      SessionBeanA.doSomething()
       EntityBeanB.create()
       SessionBeanB.doSomething()
       EntityBeanB.find...()
      


      But the finder cannot find the entry that was created above. Is this how it is supposed to be?

      Thanks for any hint
      -Danny

        • 1. Re: CMP and Transactions
          Frank Langelage Master

          I would not expect this.
          Because all beans but SessionBeanA have Transaction attribute set to Required they should run in the same db session.
          So the newly created record should be seen by the finder.
          When a finder is executed, all "dirty" EntityBeans are flushed to the database.

          • 2. Re: CMP and Transactions
            sheida sadrai Newbie

            I have the same problem.
            My first method that is REQUIRES_NEW creates a new object.
            second method that is REQUIRED retrieves some other objects from that obj like mypayment.getBookingID().getId(), but it is null. it seems session hasnt been flushed yet. How can I access my saved obj?