当前位置:网站首页>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();});}边栏推荐
- Hyper-V新建虚拟机注意事项
- UiBot has an open Microsoft Edge browser and cannot perform the installation
- VS connects to MYSQL through ODBC (2)
- [uiautomation] Get WeChat friend list (stored in txt)
- Understanding of js arrays
- 一个简单的bash转powershell案例
- Gradle sync failed: Uninitialized object exists on backward branch 142
- 360 hardening file path not exists.
- Chinese garbled solution in UTF-8 environment in Powershell
- Tencent Cloud Lightweight Server deletes all firewall rules
猜你喜欢
![[uiautomation] Get WeChat friend list (stored in txt)](/img/26/1f3424c5998c52c6e10ced8529012a.png)
[uiautomation] Get WeChat friend list (stored in txt)

Sqlite column A data is copied to column B

VS2017 connects to MYSQL

【云原生】SQL(及存储过程)跑得太慢怎么办?

VS通过ODBC连接MYSQL(一)

mysql password modification method in Linux (pro-test available)

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

Android软件安全与逆向分析阅读笔记

数据库 | SQL增删改查基础语法

Eternal blue bug reappears
随机推荐
工件SSMwar exploded 部署工件时出错。请参阅服务器日志了解详细信息
MySQL高级语句(一)
Using IIS10 to build an asp website in win11
Xiaobai learns reptiles - introduction to reptiles
[Ubuntu20.04 installs MySQL and MySQL-workbench visualization tool]
通信原理——纠错编码 | 汉明码(海明码)手算详解
Why does read in bash need to cooperate with while to read the contents of /dev/stdin
Gradle sync failed: Uninitialized object exists on backward branch 142
A simple bash to powershell case
What is the difference between NFT and digital collection?
Take you to understand the MySQL isolation level, what happens when two transactions operate on the same row of data at the same time?
Tencent Cloud Lightweight Server deletes all firewall rules
Sqlite column A data is copied to column B
Understanding of objects and functions in js
Eternal blue bug reappears
微信小程序启动优化
Global scope and function scope in js
quick-3.5 无法使用模拟器修改
为什么bash中的read要配合while才能读取/dev/stdin的内容
sqlmap injection tutorial common commands