您的位置:首页 > 其它

Hibernate3.6:org.hibernate.HibernateException: No CurrentSessionContext configured!

2013-05-21 16:11 381 查看
getCurrentSession()抛出异常: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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐