当前位置:网站首页>事务的七种传播行为
事务的七种传播行为
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的控制之下 提交或回滚。
边栏推荐
- Day-18 hash table, generic
- Leetcode question brushing: binary tree 26 (insertion operation in binary search tree)
- .Net下极限生产力之efcore分表分库全自动化迁移CodeFirst
- Several ways to clear floating
- Pule frog small 5D movie equipment | 5D movie dynamic movie experience hall | VR scenic area cinema equipment
- [statistical learning methods] learning notes - Chapter 4: naive Bayesian method
- 达晨与小米投的凌云光上市:市值153亿 为机器植入眼睛和大脑
- The URL modes supported by ThinkPHP include four common modes, pathinfo, rewrite and compatibility modes
- Common knowledge of one-dimensional array and two-dimensional array
- 2022 examination questions and online simulation examination for safety production management personnel of hazardous chemical production units
猜你喜欢

IPv6 experiment

Polymorphism, final, etc

ICLR 2022 | pre training language model based on anti self attention mechanism

leetcode刷题:二叉树20(二叉搜索树中的搜索)

Aike AI frontier promotion (7.7)

【PyTorch实战】用RNN写诗

Leetcode brush questions: binary tree 19 (merge binary tree)

ACL 2022 | small sample ner of sequence annotation: dual tower Bert model integrating tag semantics

高瓴投的澳斯康生物冲刺科创板:年营收4.5亿 丢掉与康希诺合作

Leetcode skimming: binary tree 23 (mode in binary search tree)
随机推荐
2022 polymerization process test question simulation test question bank and online simulation test
Day-24 UDP, regular expression
Leetcode skimming: binary tree 23 (mode in binary search tree)
怎样重置火狐浏览器
[statistical learning method] learning notes - logistic regression and maximum entropy model
Leetcode skimming: binary tree 27 (delete nodes in the binary search tree)
leetcode刷题:二叉树20(二叉搜索树中的搜索)
【从 0 开始学微服务】【02】从单体应用走向服务化
Leetcode brush question: binary tree 24 (the nearest common ancestor of binary tree)
[疑难杂症]pip运行突然出现ModuleNotFoundError: No module named ‘pip‘
[binary tree] delete points to form a forest
Charles: four ways to modify the input parameters or return results of the interface
Cookie
Dialogue with Wang Wenyu, co-founder of ppio: integrate edge computing resources and explore more audio and video service scenarios
Day-20 file operation, recursive copy, serialization
非分区表转换成分区表以及注意事项
【PyTorch实战】用PyTorch实现基于神经网络的图像风格迁移
免费手机号码归属地API查询接口
leetcode刷题:二叉树23(二叉搜索树中的众数)
ip2long之后有什么好处?