Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why nested transactions are not supported in JTA

Why aren't nested transactions supported by JTA? Is it because of the complexity of implementing them (which I doubt) or some design principle?

like image 842
Sandeep Jindal Avatar asked Sep 23 '12 12:09

Sandeep Jindal


People also ask

Is nested transactions are not supported by spring?

Not all transaction managers support nested transactions. Spring supports this out of the box only with the JDBC DataSourceTransactionManager, which is what we'll cover.

Is nested transactions supported by EJB?

The EJB specification allows for flat transactions only. Transactions cannot be nested.

Why is a nested transaction still useful?

A nested transaction is used to provide a transactional guarantee for a subset of operations performed within the scope of a larger transaction. Doing this allows you to commit and abort the subset of operations independently of the larger transaction.

What is nested transaction in EJB?

if a transaction begins within the context of another. *active* transaction, you would have a 'nested' transaction (which as you. know is not allowed in EJB). In other words, if you start transaction A, and. then start transaction B, without ending transaction A, then you have a.


1 Answers

Its neither the answer is business.

Many containers such as JBoss provide more complex alternative transaction managers which support concepts like nested transactions, but others like glassfish do not. Yet both of these are Java EE compliant. The idea is to keep the spec simple to lower the barrier of compliance for vendors.

Why force someone to implement a complex transaction manager that only covers .5% of transactional use cases or forgo Java EE compliance?

Nothing stops ambitious vendors from going above and beyond the specification, but they don't have the option to leave anything out.

like image 155
nsfyn55 Avatar answered Oct 07 '22 03:10

nsfyn55