开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜