`
编程足球
  • 浏览: 259444 次
  • 性别: Icon_minigender_1
  • 来自: 福州
社区版块
存档分类
最新评论

org.hibernate.HibernateException: No CurrentSessionContext configured!

阅读更多
在配置好的hibernate中运行时候发现了下面的错误
Exception in thread "main" org.hibernate.HibernateException: No CurrentSessionContext configured!
	at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:620)


上网google下找到解决的方案:
要在hibernate.cfg.xml中session-factory段加入:
1)在集成Hibernate的环境下(例如Jboss),
    <property name="current_session_context_class">jta</property>  


2)在不集成Hibernate的环境下(例如使用JDBC的独立应用程序),、
    <property name="current_session_context_class">thread</property>  
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics