Explain the similarities and differences between Spring Declarative transactions and EJB CMT(Container Managed Transactions).

Answered

Explain the similarities and differences between Spring Declarative transactions and EJB CMT(Container Managed Transactions).

Ninja Asked on 17th September 2018 in Spring.
Add Comment
1 Answer(s)
Best answer

The basic functions of both these transaction framework is the same. Both of them allow transaction to be applied at a method level and setRollbackOnly to be called within the transaction context to rollback. However Spring framework is far more versatile due to following reasons:

a) Spring declarative transactions can be applied to any class whereas EJB CMT can be applied only on EJBs
b) EJB CMT can only work with JTA whereas Spring can work with JDBC, JPA, Hibernate etc.
c) Spring framework allows declarative rollback rules whereas this can only be done programmatically in EJB CMT.

However, Spring framework does not support propagation of transactions across remote calls. This can be achieved only through EJB CMT.

Ninja Answered on 17th September 2018.
Add Comment