org hibernate HibernateException No CurrentSessionContext configured

报错信息如下:

在这里插入图片描述

在这里插入图片描述

解决方法:

问题原因是getCurrentSession()出现了问题
在hibernate.cfg.xml(hibernate的核心配置文件)文件中加入下列代码:

<property name="hibernate.current_session_context_class">thread</property>
posted @ 2019-01-11 16:43  向上的蜗牛  阅读(214)  评论(0编辑  收藏  举报