Bean-Managed Transactions (BMT) in EJB 3.1 spec allows to set transaction boundaries programmatically by obtaining a transaction and specifying `begin` and `end` of transaction in the code.
Bean-Managed Transactions (BMT) in EJB 3.1 spec allows to set transaction boundaries programmatically by obtaining a transaction and specifying begin
and end
of transaction in the code. When the transaction ends it should either commit
or rollback
. Managing beans in such a way explicitly define a control over the user transactions, independent of the container as opposed to Container-Managed Transactions (CMT) where transaction boundaries are set in a declarative way.
In a Bean-Managed transaction (BMT) code, you could explicitly mark the transaction boundaries in the session or message-driven bean. An entity bean cannot have bean-managed transactions; it must use Container-Managed Transactions (CMT) instead. Although beans with container-managed transactions require less coding, they have one limitation: when a method is executing, it can be associated with either a single transaction or no transaction at all. If this limitation will make coding your bean difficult, you should consider using bean-managed transactions.
Further reading about bean-managed transactions is from Java EE Tutorial.