org.springframework.dao.CannotAcquireLockException解决
java.sql.SQLException: Lock wait timeout exceeded
该异常为一个service中调用了另一个service,两个service对同一表进行操作,造成事务嵌套,从而死锁。
解决办法:在当前方法前加入@Transactional(propagation=Propagation.SUPPORTS)
@Transactional(propagation=Propagation.REQUIRED)
// 容器不为这个方法开启事务
@Transactional(propagation=Propagation.NOT_SUPPORTED)
// 不管是否存在事务,都创建一个新的事务,原来的挂起,新的执行完毕,继续执行老的事务
@Transactional(propagation=Propagation.REQUIRES_NEW)
// 必须在一个已有的事务中执行,否则抛出异常
@Transactional(propagation=Propagation.MANDATORY)
// 必须在一个没有的事务中执行,否则抛出异常(与Propagation.MANDATORY相反)
@Transactional(propagation=Propagation.NEVER)
// 如果其他bean调用这个方法,在其他bean中声明事务,那就用事务.如果其他bean没有声明事务,那就不用事务.
@Transactional(propagation=Propagation.SUPPORTS)
org.springframework.dao.CannotAcquireLockException解决的更多相关文章
- org.springframework.dao.CannotAcquireLockException异常分析
错误信息如下: 2017-09-27 16:27:16.153 - [com.ldyun.base.service.impl.BaseRetailOrderServiceImpl] - 新增零售商品订 ...
- Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: Multiple representations of the same entity解决方法
1.错误信息 Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUs ...
- 解决org.springframework.dao.DeadlockLoserDataAccessException
添加链接池后批量添加更新出现了死锁 org.springframework.dao.DeadlockLoserDataAccessException: ### Error updating datab ...
- java.lang.NoClassDefFoundError: org/springframework/dao/support/PersistenceE解决方法
笔者是使用spring4.0时,报的错误: 原因是没有引入spring-tx-4.0.0.RELEASE.jar包,將spring-tx-4.0.0.RELEASE.jar添加到build path中 ...
- org.springframework.dao.DataIntegrityViolationException:
数据库用的hibernate,开发工具用的myeclipse,使用开发工具连接数据库生成hibernate基于xml的po类,运行时报org.springframework.dao.DataInteg ...
- javaEE-----org.springframework.dao.InvalidDataAccessApiUsageException: Write operation
org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read ...
- org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value [41] did not match expected type [java.lang.Integer (n/a)];
题记:以前记录过一些自己遇到的BUG,这个行为,让我一看报错的提示信息就能定位到问题的所在,后来记得比较多了,好多是重复性的再加上比较忙就没有详细的记录了,今天的工作量比较小,就顺便记录一下,以便以后 ...
- OpenSessionInViewFilter与org.springframework.dao.InvalidDataAccessApiUsageException
报错:org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in r ...
- org.springframework.dao.EmptyResultDataAccessException
public Wcrash getWcrashInfo(int id) { String sql = "select plateform_id,android_version,app_ver ...
随机推荐
- Putty使用密钥登陆SSH
平时工作学习必须要使用Windows,在SSH远程连接软件里Putty算是用得比较顺手的,而且很小巧. 但是每次输入密码很麻烦,还容易输错,OpenSSH可以利用密钥来自动登陆,如此一来方便了不少.配 ...
- ES6系列_10之Symbol在对象中的作用
在ES5中 对象属性名都是字符串,这容易造成属性名的冲突,比如,你使用了一个他人提供的对象,但又想为这个对象添加新的方法(mixin 模式),新方法的名字就有可能与现有方法产生冲突,于是 ES6 引入 ...
- selenium webdriver——JS对Input执行输入
直接设置value属性, 此方法主要应对输入框自动补全以及readonly属性的element,sendkeys不稳定 比如: Demo:用JS输入 import org.openqa.seleniu ...
- 搜索框请输入关键字 onfocus 和 onblur
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- uvalive 7299 Boggle
Boggle is a game in which 16 dice with letters on each side are placed into a 4 × 4 grid. Players th ...
- 【321】python进程监控:psutil
参考:Python进程监控-MyProcMonitor 参考:Python3.6 安装psutil 模块和功能简介 参考:psutil module (Download files) 参考:廖雪峰 - ...
- python 画直方图
import numpy as npimport matplotlib.pyplot as plt def sample_data(size,length=100): data=[] for i in ...
- intellij idea15,SVN commit file提示No changes detected
备注:我用的intellij 15,已经配置了SVN.且我的工程是从SVN导出的 遇到的问题:Subversion提交代码时提示No changes detected,当然新文件想要add也是选项 ...
- Thrift 实现 JAVA,PHP,C#,Python 互相通信
Thrift介绍 https://www.ibm.com/developerworks/cn/java/j-lo-apachethrift/index.html 首先需要下载 Thrift.exe ...
- php模拟http请求
在http简析中,我们提到了浏览器请求资源的一个流程,那么这个流程能不能用php来模拟呢?答案是肯定的. php模拟http请求需要实现以下步骤: 1.连接apache服务器 使用fsockopen: ...