首页 > 代码库 > Transaction not successfully started&&Could not commit Hibernate transaction;

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

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

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

一种是:getSession的

在修改操作后加上

finally
   {   
    session.close();   
   }

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