- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我无法理解 PROPAGATION_REQUIRES_NEW
和 PROPAGATION_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/
JBoss 4.x EJB 3.0 我见过如下代码(大大简化): @Stateless @TransactionAttribute(TransactionAttributeType.NOT_SUPPO
在下面的代码方法doService1()中更新了正确的sql,但是doService2() sql有一些问题,但是当我调用doService()时即使 doService2() 有 sql 异常,它也
根据我的理解,以下代码中的 newPrint 方法应该创建一个新事务,但显然它打印出与 oldPrint 方法中使用的相同的事务状态对象。我正在从另一个类(class)调用 oldPrint。是因为使
根据 documentation , 在容器管理的事务中,如果一个方法被注释为 TransactionAttributeType.REQUIRES_NEW 属性,将暂停任何客户端事务,委托(deleg
我想集成测试一个调用使用 @Transactional(propagation = Propagation.REQUIRES_NEW) 的方法的服务方法.但是,基于内部(新)事务的断言失败。 clas
我想测试一种通过在循环中调用 DAO 将数据插入表中的服务方法。服务方法被注释为 @Transactional(propagation = Propagation.REQUIRES_NEW) 单元测试
我正在使用 EJB 3.0 开发 SAP java 应用服务器 我想一个一个地插入数据库。因为我的数据太多了,要分数据。所以我尝试了测试代码,它确实有效,但没有按我想要的那样工作。 我想为每个部分创建
考虑一个需要很长时间的事务。在此期间,我想对 TableSmall 执行一些小更新。 ,它应该立即执行,并且主事务的回滚不应该回滚那些小的更新。 我当前的问题是这些小更新将锁定 TableSmall\
我遇到这样的错误 a different object with the same identifier value was already associated with the session:
在 spring 容器中,代码如下: public class A { @Transactional public void m1() { ... b.
我有方法: @Transactional public void importChargesRequest() { ... for (Charge charge : charges)
我的 spring (4.1.1) 应用程序部署在 JBoss-6.10-final 实例上,因此它使用基于容器的事务管理器和数据源。对于消息传递,我使用 TIBCO EMS 8.1 和 XA 队列连
我的服务等级。 @Service @Transactional(value = "transactionManager", readOnly = true, propagation = Propaga
我让 spring 将服务注入(inject)自身,以允许服务对其自身进行事务调用。不幸的是,我发现抛出 NullPointerException 并被捕获的 require_new 方法不会回滚新事
我需要在 glassfish3.0 上使用 JPA 2.0 和 EJB3.0 删除忽略任何完整性约束的员工列表(即成功删除尚未与任何其他实体相关的实体或跳过与其他实体相关的实体) : 我迭代列表并在
运行我的测试时,它在调用 method() 时挂起。难道我做错了什么?救命! @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration
我测试了我的 ejb jpa 事务。我使用容器管理的 entityManager: @PersistenceContext(unitName = "ParticularUnit") EntityMan
有两个函数 A 和 B 定义了事务注解。 我正在从 A 调用 B。 @Transactional(value=Constants.READ_WRITE_REQUEST) public int A(..
同时对基于 JPA 的 DAO 层进行压力测试(同时运行 500 个同时更新,每个更新都在一个单独的线程中)。我遇到了以下-系统一直卡住无法取得任何进展。 问题是,在某个时候任何线程都没有可用的连接,
我是学习 Spring Boot 的新手。我想知道 @Transactional 注释的传播属性中 REQUIRES_NEW 的实际用例是什么。 我知道,如果新事务的请求到达,它会暂停正在进行的事务,
我是一名优秀的程序员,十分优秀!