|
org.springframework.transaction.TransactionSystemException: Could not commit Hibernate transaction; nested exception is org.hibernate.TransactionException: Transaction not successfully started
先看看SessionFactory.getCurrentSession与openSession的区别 开始用的: Session session = this.getHibernateTemplate().getSessionFactory().getCurrentSession(); 好多文章里都说只需在Spring配置<bean id="sessionFactory"...---><property name="hibernateProperties"> 中加入 <prop key="hibernate.current_session_context_class">thread</prop>就可以解决,试了没用. 修改后的: Session session = this.getHibernateTemplate().getSessionFactory().openSession(); Transaction tran=session.beginTransaction(); ...... finally 问题解决 |
本文探讨了在使用SSH操作CLOB时遇到的Transactionnotsuccessfullystarted异常,并提供了有效的解决方案,包括SessionFactory的正确使用及session的生命周期管理。
470

被折叠的 条评论
为什么被折叠?



