org.hibernate.exception.LockAcquisitionException
来源:互联网 发布:保定广电网络客服电话 编辑:程序博客网 时间:2024/06/05 21:04
org.hibernate.exception.LockAcquisitionException:could not insert: [com.yinhoo.elink.domain.UserRole]
org.springframework.dao.CannotAcquireLockException:could not insert:
[com.yinhoo.elink.domain.UserRole]; nested exception isorg.hibernate.exception.LockAcquisitionException:
could not insert:
数据库出现死锁!!!某个session(即数据库连接)在操作表UserRole时,没有提交,而该连接非正常断开
(或没有commit/rollback就断开),导致UserRole对应的表被锁住,另外的session(即数据库连接)
试图对该UserRole对应的表进行DML时就会报资源正忙无法锁定的错误!
好好检查下代码!或者,看看锁住对应的表UserRole的到底是哪个session或哪个sql,然后相应的找原因。
删除的时候马上调用getHibernateTemplate().flush();
因为你反正同一个事务中了,删除后事务还没commit,马上做插入,自然出现重复主键问题
可以调用flush()方法马上提交
楼主,楼上两位说的很清楚了。
删除操作后立即调用getHibernateTemplate().flush()可以解决问题。
在同个事务中,最好不要再一张表上进行增删(改),再事务的控制下,hibernate最终生成SQL时候是不知道如何来进行增删改的。
- org.hibernate.exception.LockAcquisitionException
- 数据库被死锁org.hibernate.exception.LockAcquisitionException: Cannot open connection
- org.hibernate.exception.SQLGrammarException
- org.hibernate.exception.SQLGrammarException
- org.hibernate.exception.SQLGrammarException
- org.hibernate.exception.GenericJDBCException
- org.hibernate.exception.GenericJDBCException
- org.hibernate.exception.SQLGrammarException
- org.hibernate.exception.ConstraintViolationException
- org.hibernate.exception.GenericJDBCException
- org.hibernate.exception.SQLGrammarException错误
- org.hibernate.exception.JDBCConnectionException: Cannot open connection
- org.hibernate.exception.GenericJDBCException: Cannot open connection
- org.hibernate.exception.GenericJDBCException: could not insert:
- org.hibernate.exception.ConstraintViolationException: could not insert
- org.hibernate.exception.SQLGrammarException: could not insert:
- org.hibernate.exception.ConstraintViolationException: could not insert
- org.hibernate.exception.GenericJDBCException: Cannot release connection
- MVC入门学习笔记(六)
- 解决 Notes Local Mail Replica Scanner v1.0 重复安装的问题
- STL sort使用
- 在VC++下和VS2005下建立openGL开发环境
- 清除记住密码的方法
- org.hibernate.exception.LockAcquisitionException
- CREATEMUTEX AND CREATEEVENT
- 寻求会员收银管理系统
- Windows核心编程学习笔记 第一部分 第一章 错误处理
- sql优化
- 一个WEB页面中代码执行次序
- JSON
- 数据复制消息WM_COPYDATA
- sql server的BCP导入导出(转)