当前位置:网站首页>Sping.事务的传播特性
Sping.事务的传播特性
2022-07-31 00:50:00 【闲猫】
图示
列表
1、PROPAGATION_REQUIRED:如果当前没有事务,就创建一个新事务,如果当前存在事务,就加入该事务,该设置是最常用的设置。
2、PROPAGATION_SUPPORTS:支持当前事务,如果当前存在事务,就加入该事务,如果当前不存在事务,就以非事务执行。
3、PROPAGATION_MANDATORY:支持当前事务,如果当前存在事务,就加入该事务,如果当前不存在事务,就抛出异常。
4、PROPAGATION_REQUIRES_NEW:创建新事务,无论当前存不存在事务,都创建新事务。
5、PROPAGATION_NOT_SUPPORTED:以非事务方式执行操作,如果当前存在事务,就把当前事务挂起。
6、PROPAGATION_NEVER:以非事务方式执行,如果当前存在事务,则抛出异常。
7、PROPAGATION_NESTED:如果当前存在事务,则在嵌套事务内执行。如果当前没有事务,则执行与PROPAGATION_REQUIRED类似的操作。
Nested和RequiresNew的区别
RequiresNew每次都创建新的独立的物理事务,而Nested只有一个物理事务;
Nested嵌套事务回滚或提交不会导致外部事务回滚或提交,但外部事务回滚将导致嵌套事务回滚,而 RequiresNew由于都是全新的事务,所以之间是无关联的;
Nested使用JDBC 3的保存点(save point)实现,即如果使用低版本驱动将导致不支持嵌套事务。
使用嵌套事务,必须确保具体事务管理器实现的nestedTransactionAllowed属性为true,否则不支持嵌套事务,如DataSourceTransactionManager默认支持,而HibernateTransactionManager默认不支持,需要设置来开启。
边栏推荐
- 牛客网刷题训练(四)
- ShardingSphere之未分片表配置实战(六)
- MySql数据恢复方法个人总结
- Why use high-defense CDN when financial, government and enterprises are attacked?
- Meeting OA project pending meeting, all meeting functions
- typescript17 - function optional parameters
- Typescript14 - (type) of the specified parameters and return values alone
- This project is so geeky
- typescript13-类型别名
- Filter (Filter)
猜你喜欢
MySQL数据库进阶篇
牛客网刷题训练(四)
DNS resolution process [visit website]
unity2D横版游戏教程4-物品收集以及物理材质
ShardingSphere's public table combat (7)
Unity2D horizontal version game tutorial 4 - item collection and physical materials
Asser uses ant sword to log in
go mode tidy出现报错go warning “all“ matched no packages
Typescript14 - (type) of the specified parameters and return values alone
Xss target drone training [success when pop-up window is realized]
随机推荐
【多线程】
人工智能与云安全
图像处理工具设计
Rocky/GNU之Zabbix部署(2)
typescript13-类型别名
MySQL triggers
The client series of the DOM series
Rocky/GNU之Zabbix部署(1)
Rocky/GNU之Zabbix部署(3)
Thesis understanding: "Designing and training of a dual CNN for image denoising"
Typescript18 - object type
typescript10-常用基础类型
【ABAP】MFBF过账到质量检验库存类型Demo
WEB Security Basics - - - Vulnerability Scanner
Neural Network (ANN)
background has no effect on child elements of float
ShardingSphere之公共表实战(七)
【952. 按公因数计算最大组件大小】
typescript16-void
程序员工作三年攒多少钱合适?