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>
本文提供了解决在集成Hibernate环境(如JBoss)中配置当前会话上下文的方法,以及在不集成Hibernate的独立应用程序中如何进行配置。详细介绍了在hibernate.cfg.xml文件中session-factory段加入相应的属性来解决问题。
1194

被折叠的 条评论
为什么被折叠?



