org.hibernate.HibernateException: No CurrentSessionContext configured!

org.hibernate.HibernateException: No CurrentSessionContext configured!錯誤

解決方案:

在集成Hibernate的環境下(例如Jboss),要在hibernate.cfg.xml中session-factory段加入:

<property name="current_session_context_class">jta</property>  

在不集成Hibernate的環境下(例如使用JDBC的獨立應用程序),在hibernate.cfg.xml中session-factory段加入: 
<property name="current_session_context_class">thread</property> 


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