`
jerryzxm
  • 浏览: 49129 次
  • 性别: Icon_minigender_1
  • 来自: 天津
社区版块
存档分类
最新评论

Transaction has been rolled back because it has been marked as rollback

 
阅读更多

 

 

参考: http://blog.csdn.net/waixin/article/details/6551457

 

org.springframework.transaction.UnexpectedRollbackException: Transaction has been rolled back because it has been marked as rollback

 

解决:

 

1. 在transactionManager中添加 globalRollbackOnParticipationFailure = false, 如下:

 

<bean id="transactionManager"
	class="org.springframework.orm.hibernate3.HibernateTransactionManager">
	<property name="sessionFactory" ref="sessionFactory" />
	<property name="globalRollbackOnParticipationFailure" value="false" />
</bean>

 2. 去掉子事务的事务拦截, 只让主事务控制提交或回滚, 如下需要去掉对bMethod()的事务拦截

 

public class AService{
    private BService bService;
    public aMethod(){
        //do something

        try{
            bService.bMethod();
        }catch(Exception e){
            log("调用bMethod()抛出异常", e);
        }
    }
}
 
分享到:
评论

相关推荐

    springboot2.0.3+activiti.5.22.0+oracle在线流程设计器(Activiti-Modeler )整合

    在IT领域,SpringBoot、Activiti和Oracle是三个非常重要的技术组件,它们分别代表了现代企业级应用开发的三大支柱:轻量级框架、工作流引擎和关系型数据库。本项目将这三者进行了深度整合,构建了一个高效、便捷的...

    Could not roll back Hibernate transaction.doc

    Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: JDBC rollback failed 这表明Hibernate事务回滚操作失败,导致事务不能正确回滚。 二、问题原因 该问题的...

    微软内部资料-SQL性能优化3

    Intent locks improve performance because SQL Server examines intent locks only at the table level to determine whether a transaction can safely acquire a lock on that table. This removes the ...

    C#中调用Transaction

    本文将深入探讨“C#中调用Transaction”的相关知识点,包括事务的基本概念、事务的特性、如何在C#代码中创建和管理事务,以及与数据库交互时事务的应用。 ### 1. 事务基本概念 事务是数据库操作的一组逻辑单元,它...

    Transaction Rollback 事务 让你的对象支持事务

    难道只要数据库连接才支持事务?... 自行实现所有细节,比如说银行的提款机模拟,在Withdraw的代码中检查支取金额后的余额或者检查支取金额的大小是否超过当天限额限制,否则报错或退出当前Withdraw方法 ...

    SQL Server数据库P166 (3)ROLLBACK TRANSACTION将显式事务或隐式事务回滚到事务的结束.sql

    内容概述:SQL Server数据库相关内容,对应张磊著《SQL Server数据库应用技术项目化教程》中166页(3)ROLLBACK TRANSACTION将显式事务或隐式事务回滚到事务的结束所对应的源码。代码经个人运行后无误,如果下载后运行...

    Activity+多个Fragment开发

    你可以使用`beginTransaction()`来开始一个事务,然后通过`add()`, `replace()`, `hide()`, `show()`等方法来添加、替换或隐藏`Fragment`。最后,记得调用`commit()`来提交这些变更。 2. **Fragment的生命周期**:`...

    Introduction to Transactions

    A transaction is a program module that starts with ‘begin transaction’ statement, ...when ‘rollback transaction’ statement returns, the effect of data modifications by the Xact will have been undone.

    COS——R.log

    org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only at org.springframework.transaction.support....

    HibernateSession , Transaction 研究

    `Session`提供了一系列的事务管理方法,如`beginTransaction()`、`commit()`和`rollback()`。 1. `beginTransaction()`:启动一个新的事务,这通常是所有数据库操作的起点。 2. `commit()`:提交当前事务,意味着...

    PLSQL.Developer(X32) v12.0.1.1814主程序+ v11中文包+keygen

    The truncate option is faster but cannot be rolled back. The Compile Invalid Objects tool now has a User Selector. PL/SQL Developer 12 now comes as a new MSI installer for interactive and silent ...

    plsqldev12.0.4.1826x32主程序+ v12中文包+keygen

    The truncate option is faster but cannot be rolled back. The Compile Invalid Objects tool now has a User Selector. PL/SQL Developer 12 now comes as a new MSI installer for interactive and silent ...

    Transaction

    在IT行业中,事务(Transaction)是数据库操作的核心概念,它确保了数据的一致性和完整性。在分布式系统和多用户环境中,事务处理对于防止数据错误和保持数据一致性至关重要。本篇文章将深入探讨“Transaction”这一...

    PLSQL.Developer(X64) v12.0.1.1814 主程序+ v11中文包+keygen

    The truncate option is faster but cannot be rolled back. The Compile Invalid Objects tool now has a User Selector. PL/SQL Developer 12 now comes as a new MSI installer for interactive and silent ...

    plsqldev12.0.4.1826x64主程序+ v12中文包+keygen

    The truncate option is faster but cannot be rolled back. The Compile Invalid Objects tool now has a User Selector. PL/SQL Developer 12 now comes as a new MSI installer for interactive and silent ...

    BURNINTEST--硬件检测工具

    - A hang on startup has been corrected. A 2 minute timeout has been added to the collection of system information. - Video playback, Hard disk and CD/DVD test 'no operations' error reporting ...

    javax.transaction-api-1.2-API文档-中文版.zip

    赠送jar包:javax.transaction-api-1.2.jar; 赠送原API文档:javax.transaction-api-1.2-javadoc.jar; 赠送源代码:javax.transaction-api-1.2-sources.jar; 赠送Maven依赖信息文件:javax.transaction-api-1.2....

    javax.transaction.jar

    【javax.transaction.jar】是Java平台上的一个核心组件,主要用于处理分布式环境中的事务管理。这个库包含了一组接口和类,这些接口和类定义了事务管理的API,使得开发者能够在Java应用程序中实现事务处理的规范。在...

Global site tag (gtag.js) - Google Analytics