When to use a global transaction or use spring aop for a transaction

Q1. I understand when we need to deal with multiple databases, we need to use a global transaction. but from this post http://fogbugz.atomikos.com/default.asp . the person suggested simply using spring aop to advise on another transaction statement (more> datasource / sessionfactory). can someone explain in what situation can we just use this approach? And in what situation do we need XA (global transaction) with atomikos or jotm or ejb..etc

+3
source share
2 answers

If you link to this post http://fogbugz.atomikos.com/default.asp?community.6.596.2 , then the important part of the question is from OP:

A task can be either a set of sql commands for datasource1 or datasource2.

In other words, the OP will not attract multiple transactional resources, it will use one or the other (and explicitly writes that it really does not need XA support). Thus, he does not need global transaction support, he can only use local transactions, and using the J2EE transaction manager is not necessary for using it.

And here is the answer: using Atomikos is not necessary and may be redundant.

dataSource, txManager, txAdvice <aop:advisor/> 'pointcut' 'advice-ref' / .

. 9.5.4. beans .

( ), , J2EE ( J2EE , Atomicos, JBossTS, JOTM, .).

+3

, , / .

, ( , )

+4

All Articles