当前位置:网站首页>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默认不支持,需要设置来开启。
边栏推荐
- The client series of the DOM series
- [C language course design] C language campus card management system
- MySQL database advanced articles
- A complete guide to avoiding pitfalls for the time-date type "yyyy-MM-dd HHmmss" in ES
- Mini Program - Global Data Sharing
- mysql索引失效的常见9种原因详解
- 【Multithreading】
- Strict Mode for Databases
- xss bypass: prompt(1)
- (5) fastai application
猜你喜欢

mysql主从复制及读写分离脚本-亲测可用

Shell programming of conditional statements

程序员工作三年攒多少钱合适?

【ABAP】MFBF过账到质量检验库存类型Demo
![[Tang Yudi Deep Learning-3D Point Cloud Combat Series] Study Notes](/img/52/88ad349eca136048acd0f328d4f33c.png)
[Tang Yudi Deep Learning-3D Point Cloud Combat Series] Study Notes

typescript11-数据类型

Detailed explanation of 9 common reasons for MySQL index failure

华为“天才少年”稚晖君又出新作,从零开始造“客制化”智能键盘

Can deep learning solve the parameters of a specific function?

typescript17-函数可选参数
随机推荐
typescript15-(同时指定参数和返回值类型)
MySQL筑基篇之增删改查
Error in go mode tidy go warning “all” matched no packages
Gabor filter study notes
SereTOD2022 Track2 Code Analysis - Task-based Dialogue Systems Challenge for Semi-Supervised and Reinforcement Learning
Rocky/GNU之Zabbix部署(1)
【Demo】ABAP Base64加解密测试
unity2D横版游戏教程4-物品收集以及物理材质
How to Add a Navigation Menu on Your WordPress Site
Oracle has a weird temporary table space shortage problem
MySql data recovery method personal summary
Filter (Filter)
【Yugong Series】July 2022 Go Teaching Course 019-For Circular Structure
[In-depth and easy-to-follow FPGA learning 13---------Test case design 1]
Unity2D horizontal version game tutorial 4 - item collection and physical materials
分布式系统的一致性与共识(1)-综述
ShardingSphere read-write separation (8)
Huawei's "genius boy" Zhihui Jun has made a new work, creating a "customized" smart keyboard from scratch
ELK deployment script---pro test available
The client series of the DOM series