Home > Back-end >  The spread of @ Transactional transaction, transaction rollback
The spread of @ Transactional transaction, transaction rollback

Time:10-18


Bosses when abnormal function D, transaction rollback will happen functions B and C
?Public class TT {

Public void (A) {

GG. (B);
GG. C ();
GG. D ();
}
}


Public class GG {

@ Transactional
Public void (B);

@ Transactional
Public void (C);

@ Transactional
Public void (D);

}

CodePudding user response:

This should be not, because the @ Transactional level is a single method,

B C D add @ Transactional will write in the same way,

CodePudding user response:

reference 1/f, walk in the four seasons of reply:
this should be not, because the @ Transactional level is a single method,

B C D add @ Transactional will write in the same way,


That on the basis of the above methods, function D E () () and the function, function E () any transaction annotations, in the function E () function when an exception occurs D () will roll back

CodePudding user response:

In A way to add annotations

CodePudding user response:

Methods depending on the A, B, C, D method of the spread of the transaction (propagation), can always open A transaction, on A BCD method USES the existing transaction context join transaction

https://developer.ibm.com/zh/articles/j-master-spring-transactional-use/

CodePudding user response:

You each method is to isolate, will not affect
  • Related