在配置好的hibernate中运行时候发现了下面的错误
上网google下找到解决的方案:
要在hibernate.cfg.xml中session-factory段加入:
1)在集成Hibernate的环境下(例如Jboss),
2)在不集成Hibernate的环境下(例如使用JDBC的独立应用程序),、
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>