事务不起作用 Closing non transactional SqlSession
2024-10-16 23:24:21
In proxy mode (which is the default), only external method calls coming in through the proxy are intercepted. This means that self-invocation, in effect, a method within the target object calling another method of the target object, will not lead to an actual transaction at runtime even if the invoked method is marked with
@Transactional
.
spring文档地址 :
http://docs.spring.io/spring/docs/4.2.0.RC1/spring-framework-reference/htmlsingle/#transaction-declarative-annotations
说明: 代理模式中,只拦截外部方法调用,开启事务。类内部调用无法实现事务控制。
错误示例:
public class Tx { public void a(){
b();
} @Transactional(propagation = Propagation.REQUIRED)
public void b(){ } }
正确示例:
public class Tx { @Transactional(propagation = Propagation.REQUIRED)
public void a(){
b();
} public void b(){ } }
最新文章
- ASP.NET MVC5+EF6+EasyUI 后台管理系统(4)-创建项目解决方案
- 移动端接口:java写get方式访问数据(springmvc+spring。。。)
- MySQL数据库常用命令
- java错误
- 前端打包/自动化构建工具:gulp
- mysql 存储结构
- 编译 Spring-framework的经验分享
- iconv内容,convmv文件名,unix2dos,dos2unix文件格式转换,od/cut/wc/dd/diff/uniq/nice/du等命令,linux文件名乱码,文件名,文件内容,vim编码设置
- Aggregating tests in suites
- ManagedPipelineHandler IIS
- Android中特殊图形的生成样例
- js全选与反选
- call和apply的小结
- MySQL管理员珍藏:十大必备工具盘点
- 学习go语言编程系列之定义变量
- python类型错误:'NoneType' object is not subscriptable
- [01] 初识SpringBoot:Hello World
- Python高级网络编程系列之第一篇
- SVN同步时报错:“Previous operation has not finished; run 'cleanup' if it was interrupted”
- 关于ajax上传文件的流程 和选择图片立即显示