参考: 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);
}
}
}
分享到:
相关推荐
在IT领域,SpringBoot、Activiti和Oracle是三个非常重要的技术组件,它们分别代表了现代企业级应用开发的三大支柱:轻量级框架、工作流引擎和关系型数据库。本项目将这三者进行了深度整合,构建了一个高效、便捷的...
Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: JDBC rollback failed 这表明Hibernate事务回滚操作失败,导致事务不能正确回滚。 二、问题原因 该问题的...
如果有任何异常,调用rollback方法。 6. **清理资源**: 提交或回滚后,释放占用的资源,如关闭数据库连接。 在实际应用中,可能会遇到各种挑战,如事务的隔离级别、事务的一致性、性能影响等。例如,为了保证数据...
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#代码中创建和管理事务,以及与数据库交互时事务的应用。 ### 1. 事务基本概念 事务是数据库操作的一组逻辑单元,它...
难道只要数据库连接才支持事务?... 自行实现所有细节,比如说银行的提款机模拟,在Withdraw的代码中检查支取金额后的余额或者检查支取金额的大小是否超过当天限额限制,否则报错或退出当前Withdraw方法 ...
内容概述:SQL Server数据库相关内容,对应张磊著《SQL Server数据库应用技术项目化教程》中166页(3)ROLLBACK TRANSACTION将显式事务或隐式事务回滚到事务的结束所对应的源码。代码经个人运行后无误,如果下载后运行...
你可以使用`beginTransaction()`来开始一个事务,然后通过`add()`, `replace()`, `hide()`, `show()`等方法来添加、替换或隐藏`Fragment`。最后,记得调用`commit()`来提交这些变更。 2. **Fragment的生命周期**:`...
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.
org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only at org.springframework.transaction.support....
`Session`提供了一系列的事务管理方法,如`beginTransaction()`、`commit()`和`rollback()`。 1. `beginTransaction()`:启动一个新的事务,这通常是所有数据库操作的起点。 2. `commit()`:提交当前事务,意味着...
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 ...
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 ...
在IT行业中,事务(Transaction)是数据库操作的核心概念,它确保了数据的一致性和完整性。在分布式系统和多用户环境中,事务处理对于防止数据错误和保持数据一致性至关重要。本篇文章将深入探讨“Transaction”这一...
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 ...
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 ...
- 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 ...
赠送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....