No CurrentSessionContext configured 异常的解决

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>