当前位置:网站首页>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();});}边栏推荐
- 【云原生】微服务Nacos的简单介绍与使用
- [Cloud native] Ribbon is no longer used at the bottom layer of OpenFeign starting from the 2020.0.X version
- js中的函数
- Artifact SSMwar exploded Error deploying artifact.See server log for details
- C语言 | 获取字符串里逗号间隔的内容
- Getting to know regular expressions
- MySQL压缩包方式安装,傻瓜式教学
- quick-3.5 ActionTimeline的setLastFrameCallFunc调用会崩溃问题
- [uiautomation] Get WeChat friend list (stored in txt)
- 360 hardening file path not exists.
猜你喜欢

MySql创建数据表

What is an EVM Compatible Chain?

动态规划(一)| 斐波那契数列和归递

安装Multisim出现 No software will be installed or removed解决方法

The feign call fails, JSON parse error Illegal character ((CTRL-CHAR, code 31)) only regular white space (r

unicloud 发布后小程序提示连接本地调试服务失败,请检查客户端是否和主机在同一局域网下

著名网站msdn.itellyou.cn原理分析

flutter 混合开发 module 依赖

Common JVM interview questions and answers

工件SSMwar exploded 部署工件时出错。请参阅服务器日志了解详细信息
随机推荐
Markdown 帮助文档
[Elastic-Job] Overview of Distributed Scheduling Tasks
【云原生】开源数据分析 SPL 轻松应对 T+0
Navicat从本地文件中导入sql文件
MySql创建数据表
Xiaobai learns reptiles - introduction to reptiles
Tencent Cloud Lightweight Server deletes all firewall rules
Error: Cannot find module 'D:\Application\nodejs\node_modules\npm\bin\npm-cli.js'
Xiaomi mobile phone SMS location service activation failed
flutter arr dependencies
场效应管 | N-mos内部结构详解
Several solutions for mysql startup error The server quit without updating PID file
Understanding SSRF, this article is enough
js中流程控制语句
podspec自动化升级脚本
安装Multisim出现 No software will be installed or removed解决方法
UiBot存在已打开的MicrosoftEdge浏览器,无法执行安装
quick-3.5 无法使用模拟器修改
DeFi Token in the project management
Understanding of objects and functions in js