当前位置:网站首页>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默认不支持,需要设置来开启。
边栏推荐
- Unity2D horizontal version game tutorial 4 - item collection and physical materials
- Add text watermark to PHP image
- 【Yugong Series】July 2022 Go Teaching Course 019-For Circular Structure
- Common network status codes
- typescript17 - function optional parameters
- ShardingSphere之读写分离(八)
- Kotlin协程:协程上下文与上下文元素
- C语言力扣第48题之旋转图像。辅助数组
- 【Yugong Series】July 2022 Go Teaching Course 013-Constants, Pointers
- What is Promise?What is the principle of Promise?How to use Promises?
猜你喜欢

MySQL grant statements

Mini Program - Global Data Sharing

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

DOM系列之 client 系列

WEB Security Basics - - - Vulnerability Scanner

API 网关 APISIX 在Google Cloud T2A 和 T2D 的性能测试

BOM系列之Navigator对象

MySQL database (basic)

A complete guide to avoiding pitfalls for the time-date type "yyyy-MM-dd HHmmss" in ES

go mode tidy出现报错go warning “all“ matched no packages
随机推荐
BOM系列之history对象
SereTOD2022 Track2 Code Analysis - Task-based Dialogue Systems Challenge for Semi-Supervised and Reinforcement Learning
ECCV 2022丨轻量级模型架构火了,力压苹果MobileViT(附代码和论文下载)
How to Add a Navigation Menu on Your WordPress Site
不用Swagger,那我用啥?
Yolov7实战,实现网页端的实时目标检测
Responsive layout vs px/em/rem
Understand from the 11 common examples of judging equality of packaging types in the written test: packaging types, the principle of automatic boxing and unboxing, the timing of boxing and unboxing, a
人工智能与云安全
Restricted character bypass
Error occurred while trying to proxy request项目突然起不来了
Error ER_NOT_SUPPORTED_AUTH_MODE Client does not support authentication protocol requested by serv
C语言力扣第48题之旋转图像。辅助数组
权限管理怎么做的?
Meeting OA project pending meeting, all meeting functions
MySQL master-slave replication and read-write separation script - pro test available
解决:Parameter 0 of method ribbonServerList in com.alibaba.cloud.nacos.ribbon.NacosRibbonClientConfigu
Solution: Parameter 0 of method ribbonServerList in com.alibaba.cloud.nacos.ribbon.NacosRibbonClientConfigu
typescript10-常用基础类型
Basic usage of async functions and await expressions in ES6