当前位置:网站首页>TransactionTemplate transaction programmatic way
TransactionTemplate transaction programmatic way
2022-07-31 06:01:00 【Floating life like a dream】
It is recommended to use declarative transaction @Transactional(rollbackFor = Exception.class) granularity is not enough, split method
import org.springframework.transaction.support.TransactionTemplate;@Autowiredprivate TransactionTemplate trans;/*** Programmatic transactions*/public void transfer() {// no return valuetrans.executeWithoutResult((status) ->{boolean save = this.save(t);if(!save) {status.setRollbackOnly();}});// have return valuetrans.execute((status) ->{boolean save = this.save(t);if(!save) {status.setRollbackOnly();}return new Object();});}边栏推荐
猜你喜欢

npm WARN config global `--global`, `--local` are deprecated. Use `--location solution

qt:cannot open C:\Users\某某某\AppData\Local\Temp\main.obj.15576.16.jom for write

What is the difference between NFT and digital collection?

flutter arr 依赖
![[Cloud native] Open source data analysis SPL easily copes with T+0](/img/89/4a96358956782ef9dacf0b700b54c3.png)
[Cloud native] Open source data analysis SPL easily copes with T+0

QT VS中双击ui文件无法打开的问题

Error: Cannot find module 'D:\Application\nodejs\node_modules\npm\bin\npm-cli.js'

浏览器查找js绑定或者监听的事件

一文速学-玩转MySQL获取时间、格式转换各类操作方法详解

qt:cannot open C:\Users\XX\AppData\Local\Temp\main.obj.15576.16.jom for write
随机推荐
Take you to understand the MySQL isolation level, what happens when two transactions operate on the same row of data at the same time?
This in js points to the prototype object
js中流程控制语句
[Cloud native] Ribbon is no longer used at the bottom layer of OpenFeign starting from the 2020.0.X version
Web Screenshots and Reverse Proxy
Android软件安全与逆向分析阅读笔记
[Ubuntu20.04 installs MySQL and MySQL-workbench visualization tool]
MySql to create data tables
[Cloud native] Simple introduction and use of microservice Nacos
SSH自动重连脚本
ERROR Error: No module factory availabl at Object.PROJECT_CONFIG_JSON_NOT_VALID_OR_NOT_EXIST ‘Error
cocos2d-x-3.x 修改和纪录
this points to the problem
js中的this指向与原型对象
VS通过ODBC连接MYSQL(一)
Gradle sync failed: Uninitialized object exists on backward branch 142
Sqlite A列数据复制到B列
sql 添加 default 约束
VTK环境配置
Nmap的下载与安装