transaction type
Transaction types can be divided into local transactions and distributed transactions.
two-phase commit protocol
Distributed transaction means that a transaction may involve multiple database operations. The key to distributed transaction processing is that there must be a way to know all the actions performed by the transaction anywhere, and the decision to commit or roll back the transaction must produce a uniform result ( commit all or rollback all).
The most popular distributed transaction protocol today is the XA protocol. The basis of the XA specification is the two-phase commit protocol.
EJB transaction management
EJBs have two ways of using transactions. One is to manage transactions declaratively through container-managed transactions, which can be done through annotations or deployment description files, and the other is bean-managed transactions that require programmatically managed transactions explicitly.