当前位置:网站首页>事务的七种传播行为
事务的七种传播行为
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的控制之下 提交或回滚。
边栏推荐
- Common knowledge of one-dimensional array and two-dimensional array
- JS to convert array to tree data
- 基于NeRF的三维内容生成
- Day-14 common APIs
- visual stdio 2017关于opencv4.1的环境配置
- Realize a simple version of array by yourself from
- ACL 2022 | 序列标注的小样本NER:融合标签语义的双塔BERT模型
- [binary tree] delete points to form a forest
- ip2long之后有什么好处?
- Sorting, dichotomy
猜你喜欢
2022 examination questions and online simulation examination for safety production management personnel of hazardous chemical production units
On valuation model (II): PE index II - PE band
[pytorch practice] use pytorch to realize image style migration based on neural network
Polymorphism, final, etc
visual stdio 2017关于opencv4.1的环境配置
How to use PS link layer and shortcut keys, and how to do PS layer link
Charles: four ways to modify the input parameters or return results of the interface
【统计学习方法】学习笔记——第五章:决策树
Cookie
Creation and assignment of graphic objects
随机推荐
Find ID value MySQL in string
Cookie
密码学系列之:在线证书状态协议OCSP详解
Charles: four ways to modify the input parameters or return results of the interface
2022聚合工艺考试题模拟考试题库及在线模拟考试
Leetcode skimming: binary tree 20 (search in binary search tree)
【从 0 开始学微服务】【00】课程概述
Day-14 common APIs
What if the xshell evaluation period has expired
2022-07-07 Daily: Ian Goodfellow, the inventor of Gan, officially joined deepmind
Object. Simple implementation of assign()
[learn wechat from 0] [00] Course Overview
Realize all, race, allsettled and any of the simple version of promise by yourself
基于NeRF的三维内容生成
leetcode刷题:二叉树26(二叉搜索树中的插入操作)
博文推荐|Apache Pulsar 跨地域复制方案选型实践
【从 0 开始学微服务】【02】从单体应用走向服务化
Preorder, inorder and postorder traversal of binary tree
.Net下极限生产力之efcore分表分库全自动化迁移CodeFirst
JS to convert array to tree data