這段時間開始研究hibernate,開始了解最新的hibernate技術(問題一)Hibernate的No CurrentSessionContext configured 解決方案
Posted on 2007-05-10 13:19 天空蒼茫 閱讀(580) 評論(0) 編輯 收藏 所屬分類: hibernate今天按照滿江紅翻譯的hibernate文檔來做第一個簡單的程序,卻出現No CurrentSessionContext configured 問題。在google上搜索,卻發現是
是由于沒有配置:current_session_context_class
在hibernate的配置文件中增加<property name="current_session_context_class">thread</property>
原因:當你使用 Hibernate session factory的getCurrentSession() 函數時候,你可能見到過"No CurrentSessionContext configured!"
出現這個問題,是因為你沒有正確配置 Hibernate internal session context management .