Transaction not successfully started&&Could not commit Hibernate transaction;

记录一下这个问题,解决方法是分两种情况,

一种是getCurrentSession();这种情况加入配置:
<property name="hibernate.current_session_context_class">thread</property>

一种是:getSession的

在修改操作后加上

finally
   {   
    session.close();   
   }

时间: 2024-10-15 10:03:18

Transaction not successfully started&&Could not commit Hibernate transaction;的相关文章

Hibernate 错误解决(TransactionException: Transaction not successfully started)

[关键的错误信息]: TransactionException: Transaction not successfully started 和一个doCommit 从该关键字看,是使用Hibernate事务管理器(而不是Spring,下面详细log的绿色字体)处理事务的commit时抛出的, [具体解决]: //下面的代码段会报错 Session session = getSessionFactory().getCurrentSession(); session.beginTransaction

有关Transaction not successfully started问题解决办法

我的项目配置:struts2+hibernate3.3+spring3.2.5 主要问题:在进行更新和提交操作时出现以下异常 org.springframework.transaction.TransactionSystemException: Could not commit Hibernate transaction; nested exception is org.hibernate.TransactionException: Transaction not successfully st

异常:Transaction not successfully started

异常:org.hibernate.TransactionException: Transaction not successfully started 错误代码: service层 Session session = HibernateUtils.getCurrentSession(); //....数据库操作语句(调用dao层) Transaction tx = session.beginTransaction(); tx.commit(); dao层 Session session = Hi

django 事务错误 -- Transaction managed block ended with pending COMMIT/ROLLBACK

1 Request Method: GET 2 Request URL: http://192.168.128.111:8000/×××/××××/ 3 Django Version: 1.4.8 4 Exception Type: TransactionManagementError 5 Exception Value: 6 Transaction managed block ended with pending COMMIT/ROLLBACK 今天在做事务处理的时候老是出现这个问题,我研究了

MySQL的8小时连接超时时间,导致系统过夜即崩溃,报错Could not roll back Hibernate transaction

2014年3月开始给单位开发<机关规范化管理网络平台>,10月底成功上线运行,但是存在一个bug: 部署环境: apache tomcat 6.0.41 + mysql5.5 + jbpm Bug重现方法: 部署好环境后,在无用户访问该系统的情况下,过一晚上,第二天再登录就会报出如下错误:Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: JDBC

解决Could not commit JPA transaction RollbackException: Transaction marked as rollbackOnly

项目测试发生问题,方法正常结束,但是报了 Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested ex

The Microsoft Distributed Transaction Coordinator (MS DTC) has cancelled the distributed transaction.

同事反馈一个系统在运行一个存储过程时遇到了下面错误: Msg 1206, Level 18, State 169, Procedure xxxxxx, Line 118The Microsoft Distributed Transaction Coordinator (MS DTC) has cancelled the distributed transaction. 费了九牛二虎之力才定位到是我们一个作业把对应的会话给Kill掉了(此作业按条件Kill掉那些阻塞其它会话的会话).今天在测试服务

org.hibernate.TransactionException: Transaction not successfully started

http://www.yinyuetai.com/playlist/3310702http://www.yinyuetai.com/playlist/3310711http://www.yinyuetai.com/playlist/3310712http://www.yinyuetai.com/playlist/3310724http://www.yinyuetai.com/playlist/3310725http://www.yinyuetai.com/playlist/3310739http

Could not commit JPA transaction; nested exception is javax.persistence.RollbackException

原因:同一service方法里多次save导致,save过一次,事务已经提交了,如果再次save,则事务已经变为回滚状态,已经不能再次提交事务了.