开发者

what exactly "Propagation.REQUIRES_NEW" means using Spring transaction management?

开发者 https://www.devze.com 2023-02-28 23:30 出处:网络
my confusion related to this matter is that how we can use a previously created transaction? or in other words how many threads a transaction could be r开发者_C百科elated to?A transaction can be relat

my confusion related to this matter is that how we can use a previously created transaction? or in other words how many threads a transaction could be r开发者_C百科elated to?


A transaction can be related to only one thread in spring. Well, with some effort you can make it a long-running transaction, but that's an anti-pattern afaik.

REQUIRES_NEW means that whenever the program flow enters the annotated method, a new transaction will be started regardless of any existing transaction.

REQUIRED means that an existing transaction will be reused, or if there's no existing transaction a new one will be started.

0

精彩评论

暂无评论...
验证码 换一张
取 消