Thursday 18 June 2015

JTA bean-managed transaction. Why?

Bean-managed transaction (BMT), also known as programatic transactions are implemented with the
help of javax.transaction.UserTransaction inteface, which have the commit(), the begin(), the rollback() methods, Why we need it? There are 3 possible reasons:

  1. We want to use a transaction not in EJB beans (we can use it in POJO or CDI bean)
  2. We want a one transaction during several request.
  3. We want client-initiated Transactions: a client, such as an applet, can obtain a reference to the UserTransaction and TransactionManager objects using JNDI. A client can begin a transaction using either object reference