gpt4 book ai didi

java - Spring事务中requires_new和嵌套传播的区别

转载 作者:IT老高 更新时间:2023-10-28 13:01:36 25 4
gpt4 key购买 nike

我无法理解 PROPAGATION_REQUIRES_NEWPROPAGATION_NESTED 传播策略之间的行为差​​异。在我看来,在这两种情况下,当前进程都是回滚的,而不是整个事务。有什么线索吗?

最佳答案

查看此链接:PROPAGATION_NESTED versus PROPAGATION_REQUIRES_NEW? Juergen Hoeller 解释得很好。 -- Spring 源码论坛自 2019 年 2 月 28 日起完全下线,但您可以在下面的引文中阅读文章的相关部分

PROPAGATION_REQUIRES_NEW starts a new, independent "inner" transactionfor the given scope. This transaction will be committed or rolled backcompletely independent from the outer transaction, having its ownisolation scope, its own set of locks, etc. The outer transaction willget suspended at the beginning of the inner one, and resumed once theinner one has completed. ...

PROPAGATION_NESTED on the other hand starts a "nested" transaction,which is a true subtransaction of the existing one. What will happenis that a savepoint will be taken at the start of the nestedtransaction. Íf the nested transaction fails, we will roll back tothat savepoint. The nested transaction is part of of the outertransaction, so it will only be committed at the end of of the outertransaction. ...

关于java - Spring事务中requires_new和嵌套传播的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12390888/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com