当前位置:网站首页>事务的七种传播行为
事务的七种传播行为
2022-07-07 10:41:00 【白羊座橙子的学习笔记】
一、什么是事务的传播行为
事务的传播行为指的是: 当一个事务方法被另一个事务方法调用时,这个事务方法应该如何运行。
例如:methodA方法调用methodB方法时,methodB是继续在调用者A的事务中运行呢,还是为自己开启一个新事务运行。这就是由methodB的事务传播行为决定的。
二、事务的七种传播行为
1、PROPAGATION_REQUIRED:如果当前没有事务,就创建一个新事务;如果当前存在事务,就加入改事务(这是最常见的选择)
2、PROPAGATION_SUPPORTS:如果当前存在事务,就加入该事务;如果当前不存在事务,就以非事务执行
3、PROPAGATION_MANDATORY:如果当前存在事务,就加入该事务;如果当前不存在事务,就抛出异常
4、PROPAGATION_REQUIRES_NEW:无论当前存不存在事务,都创建新事务
5、PROPAGATION_NOT_SUPPORTED:以非事务方式执行操作,如果当前存在事务,就把当前事务挂起
6、PROPAGATION_NEVER:以非事务方式执行,如果当前存在事务,则抛出异常
7、PROPAGATION_NESTED:
三、上面一些概念的理解
1、事务挂起
例如 方法A支持事务,方法B不支持事务,方法A调用方法B
在方法A开始运行时,系统为它建立Transaction,方法A中对于数据库的处理操作,会在该Transaction的控制之下。这时,方法A调用方法B,方法A打开的 Transaction将挂起,方法B中任何数据库操作,都不在该Transaction的管理之下。当方法B返回,方法A继续运行,之前的Transaction回复,后面的数据库操作继续在该Transaction的控制之下 提交或回滚。
边栏推荐
- Utiliser la pile pour convertir le binaire en décimal
- 【统计学习方法】学习笔记——第五章:决策树
- Multi row and multi column flex layout
- [learn microservice from 0] [01] what is microservice
- Day-18 hash table, generic
- ACL 2022 | small sample ner of sequence annotation: dual tower Bert model integrating tag semantics
- visual stdio 2017关于opencv4.1的环境配置
- Importance of database security
- leetcode刷题:二叉树25(二叉搜索树的最近公共祖先)
- The URL modes supported by ThinkPHP include four common modes, pathinfo, rewrite and compatibility modes
猜你喜欢
Polymorphism, final, etc
The IDM server response shows that you do not have permission to download the solution tutorial
Cookie
2022 practice questions and mock examination of the third batch of Guangdong Provincial Safety Officer a certificate (main person in charge)
ICLR 2022 | 基于对抗自注意力机制的预训练语言模型
Leetcode skimming: binary tree 27 (delete nodes in the binary search tree)
【统计学习方法】学习笔记——提升方法
[statistical learning methods] learning notes - improvement methods
HZOJ #240. 图形打印四
《ASP.NET Core 6框架揭秘》样章[200页/5章]
随机推荐
Day22 deadlock, thread communication, singleton mode
[爬虫]使用selenium时,躲避脚本检测
On valuation model (II): PE index II - PE band
【从 0 开始学微服务】【01】什么是微服务
[learn microservice from 0] [01] what is microservice
非分区表转换成分区表以及注意事项
Leetcode skimming: binary tree 22 (minimum absolute difference of binary search tree)
GCC compilation error
Multi row and multi column flex layout
Day-14 common APIs
广州市召开安全生产工作会议
Image pixel read / write operation
Vxlan static centralized gateway
Day-24 UDP, regular expression
Design and implementation of communication protocol
The left-hand side of an assignment expression may not be an optional property access. ts(2779)
《ASP.NET Core 6框架揭秘》样章[200页/5章]
Cookie
2022 examination questions and online simulation examination for safety production management personnel of hazardous chemical production units
Leetcode skimming: binary tree 27 (delete nodes in the binary search tree)