Things you must NOT do with BMT
A BMT bean must NOT start a transaction before ending the current transaction.
Brain Power
Imagine the implications of starting a new transaction before ending the current one. What might happen if you were allowed to do this?
Note
Nested transactions are not allowed in EJB!
You’re expected to know what the term “nested transaction” means, and what it might look like in code.
A BMT stateless session or message-driven bean must NOT complete a transactional method without ending the transaction.
Brain Power
Why are stateful session beans allowed to end a method without ending the transaction?
For a stateful bean, can you think of a scenario where you might want to do this (leave the transaction open)?
What might go wrong if you do this?
Note
Only STATEFUL session beans can leave a transaction open at the end of a method.
BMT transactions are one way: they can propagate out to a CMT bean, but no other transaction can propagate in to a BMT bean
Both BMT and CMT bean transactions propagate into a CMT bean.
A CMT bean can run in transactions coming from both CMT and BMT beans. ...
Get Head First EJB now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.