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


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