Maintaining transactions

Discussions

EJB programming & troubleshooting: Maintaining transactions

  1. Maintaining transactions (2 messages)

    I have a session bean which will invoke the create methods of 3 CMP Entity Beans as follows.

    CMPBean1.create(param1,param2...);
    CMPBean2.create(param1,param2...);
    CMPBean3.create(param1,param2...);

    These create statements should belong to one transaction. either all
    should be inserted into their corresponding tables or neither of them.

    do we have to start a transaction in the session bean if we have to
    perform the above task?

    Threaded Messages (2)

  2. Maintaining transactions[ Go to top ]

    The easiest way is to use container managed transactions. Just set the transaction attribute of the method that triggers these create calls to "Required" and everything will work.

    If for some reason you have to use bean managed transactions, a transaction should be in scope when you call the create methods.

    Gal
  3. Maintaining transactions[ Go to top ]

    Hello Gal,
    I have question for you as I went through your ans on Transaction can you just explain it in more detail and also
    how can we roll back all the transactions in Container managed transaction.

    Alok