Distributed Transactions   «Prev 
122

EJB Container interposition using a Banking Example

1) The client to the BankAccount bean instance invokes the credit() method on the EJBObject.
The client to the BankAccount bean instance invokes the credit() method on the EJBObject.

2) The EJBObject of the BankAccount's instance EJBOject, which is really part of the container, starts the transaction
The EJBObject of the BankAccount's instance EJBOject, which is really part of the container, starts the transaction

3) The EJBObject, having started the transaction, invokes the credit() method
The EJBObject, having started the transaction, invokes the credit() method of the instance.

4) The bean performs the credit() method. The last step in this method is to write the data to the persistent store.
The bean performs the credit() method. The last step in this method is to write the data to the persistent store.

5) The method is complete so control is returned back to the EJBObject
The method is complete so control is returned back to the EJBObject

6) The EJBObject commits the transaction on behalf of the bean instance. The data at this point, will be permanently written to the database or rolled back if there was any problem.
The EJBObject commits the transaction on behalf of the bean instance. The data at this point, will be permanently written to the database or rolled back if there was any problem.

7) The EJBObject returns back to the client.
The EJBObject returns back to the client.