transaction already active
来源:互联网 发布:上海软件协会网站 编辑:程序博客网 时间:2024/04/30 23:45
这个问题是使用spring 事务管理时经常出现的错误,最开始时相当令我头疼,也不知道是哪里出现的问题。在网上找了一阵后,依然无解。意思就是说上一个事务处于激活状态中,不能开始新的数据库更新操作。
开始事务的方法一般是这样的:
EntityTransaction txn = slavesDao.startTransaction();
try {
...
//slavesDao.delete(vsi) ;
slavesDao.update(vsi) ;
txn.commit();
}catch (Exception e){
txn.rollback();
throw new Exception("delete Error: " + e.getMessage(), e);
}
如果只是执行完了第一行语句,然后根本就没有执行到txn.commit();这一步,那么要开始下一个事务就会出这样的错,所以我们一般应该检查自己的逻辑是否正确!
- transaction already active
- java.lang.IllegalStateException: Transaction already active
- without active transaction
- createQuery without an active transaction
- 解决Fragment already active方法
- 解析 IllegalStateException--"Fragment already active"
- The transaction is not active!解决方案
- Transaction log impact of active transactions
- createQuery is not valid without active transaction
- getFlushMode is not valid without active transaction
- weblogic The transaction is no longer active
- createQuery is not valid without active transaction
- createQuery is not valid without active transaction
- getHibernateFlushMode is not valid without active transaction;
- getFlushMode is not valid without active transaction
- No transaction is currently active问题
- server is already active for display 0
- java.lang.IllegalStateException: Fragment already active
- jQuery 对表单的简单验证
- 高级招聘题目
- 在 ASP.NET MVC 中创建自定义 HtmlHelper 控件
- CString、BSTR和LPCTSTR之间的区别
- C语言中char int转换问题
- transaction already active
- 转载:中国惠普前总裁孙振耀谈工作与生活
- shell 命令小计——工作笔记
- 利用IWebBrowser2接口的Navigate2方法实现Http POST传输
- adb log 分析
- java.lang.Thread.State类详解
- Android 快捷方式
- 正则验证
- scala