删除以下行,当Spring管理事务时,不需要它们:
<prop key="hibernate.current_session_context_class">thread</prop> <prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</prop>
实际上,设置
hibernate.current_session_context_class有效地禁用了Spring事务管理,请参阅
AbstractSessionFactoryBean.setExposeTransactionAwareSessionFactory()javadoc:
关闭此标志以使用Hibernate的默认getCurrentSession()行为公开纯Hibernate
SessionFactory,仅支持纯JTA同步。或者,只需重写相应的Hibernate属性“
hibernate.current_session_context_class”。



