Best Practices

Bean-managed transaction demarcation is only used by more advanced users who want more control over the application workflow. The J2EE architecture recommends managing transactions through container-managed demarcation. Declarative transaction management provides one of the major benefits of the J2EE platform, by freeing the EJB developer from the burden of managing transactions.

Use JTA, where possible, in managing transaction boundaries in enterprise applications. This guarantees data consistency and integrity, and ensures that work performed by multiple components through multiple resource managers is grouped as an atomic unit.

Only session beans and message-driven beans can use both bean-managed transaction and container-managed ...

Get Sams Teach Yourself EJB in 21 Days 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.