Spring 整合 hibernate 时,抛异常: createQuery is not valid without active transaction

在ssh4中的sessionFactory配置文件中应将hibernate.current_session_context_class设为org.springframework.orm.hibernate3.SpringSessionContext(默认为此值),并应用spring管理事务。

如果为<prop key="hibernate.current_session_context_class">thread</prop> 则会报该异常。


解决方案:

将 <prop key="hibernate.current_session_context_class">thread</prop> 删除,

或者改为默认值:org.springframework.orm.hibernate3.SpringSessionContext


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章