报错信息如下:



解决方法:

问题原因是getCurrentSession()出现了问题

在hibernate.cfg.xml(hibernate的核心配置文件)文件中加入下列代码:

<property name="hibernate.current_session_context_class">thread</property>

Hibernate中报错org.hibernate.HibernateException: No CurrentSessionContext configured!的更多相关文章

  1. hibernate报错org.hibernate.HibernateException: No CurrentSessionContext configured!

    org.hibernate.HibernateException: No CurrentSessionContext configured! at org.hibernate.internal.Ses ...

  2. Hibernate(三): org.hibernate.HibernateException: No CurrentSessionContext configured!

    Hibernate版本5.2.9 获取Session的方式是sessionFactory.getCurrentSession(); 比较老一些的版本使用的是sessionFactory.openSes ...

  3. org.hibernate.HibernateException: No CurrentSessionContext configured!

    hibernate可以通过两种方式获得Session: getCurrentSession() 和openSession(). 当通过getCurrentSession()方法时,需要在 hibern ...

  4. Hibernate 报错org.hibernate.PropertyAccessException: IllegalArgumentException(已解决)

    无聊想搭建一个项目,练手,做点小功能就一个卡在这个问题上 org.hibernate.PropertyAccessException: IllegalArgumentException occurre ...

  5. hibernate报错org.hibernate.SessionException: Session was already closed

    org.hibernate.SessionException: Session was already closedat org.hibernate.internal.SessionImpl.clos ...

  6. No CurrentSessionContext configured 异常解决

    Exception in thread "main" org.hibernate.HibernateException: No CurrentSessionContext conf ...

  7. 使用hibernate时出现 org.hibernate.HibernateException: Unable to get the default Bean Validation factory

    hibernate 在使用junit测试报错: org.hibernate.HibernateException: Unable to get the default Bean Validation ...

  8. Hibernate 异常 —— No CurrentSessionContext configured

    在使用 SessionFactory 的 getCurrentSession 方法时遇到如下异常 “No CurrentSessionContext configured ” 原因是: 在hibern ...

  9. Hibernate报错,关于配置的SessionFactory找不到问题

    最近写项目使用hibernate默认的dtd,在启动项目时经常会出现这个问题,hibernate报错,配置factory的id找不到,找不到mapping配置文件, 不能读取配置的xml文件 Coul ...

随机推荐

  1. 【MySql】delete用法

    delete 语句用于删除表中的数据, 基本用法为: delete from 表名称 where 删除条件; 以下是在表 students 中的实例: 删除 id 为 3 的行: delete fro ...

  2. nodejs之koa-router与koa-body搭配使用

    简介 koa需要搭配中间件来做接口更方便,使用Koa-body & Koa-router 使用 koa2 创建接口,处理post请求 const koa=require("koa&q ...

  3. Java的家庭记账本程序(D)

    日期:2019.2.8 博客期:031 星期一 今天是把程序的查询功能以列表的形式完成了! 截图如下:

  4. WinHex数据恢复笔记(一)

    WinHex数据恢复功能强大,可以从硬件簇上扇区进行数据扫描恢复.首先对winhex的各个功能介绍.之后对实例记录一个Word文档删除后进行恢复. 1.WinHex数据恢复软件的编辑区输入与其他普通文 ...

  5. Python之yield简明详解

    yield在Python中被称之为生成器(只能在函数中使用),他的作用是将函数中每次执行的结果以类似元组的形式保存起来一遍后续使用. 什么是生成器? 通过列表生成式,我们可以直接创建一个列表.但是,受 ...

  6. 把tomcat服务器配置为windows服务的方法

    转自:http://ykyfendou.iteye.com/blog/2032916 使用tomcat开发的项目,我们把项目交付给客户的时候,客户都不希望在每次开机的时候都要启动一下tomcat服务器 ...

  7. asp.net core 自定义404等友好错误页面

    Home控制器里: [Route("Home/Error/{statusCode}")] public IActionResult Error(int statusCode) { ...

  8. 关于前端滚动条,input框等样式的修改

    1.改变滚动条的样式 .orderList::-webkit-scrollbar {/*滚动条整体样式*/ width: 4px; /*高宽分别对应横竖滚动条的尺寸*/ height: 4px;}.o ...

  9. Linux桌面环境安装matlab并创建快捷方式

    安装matlab sudo mkdir -p /mnt/matlab sudo mount -t auto -o loop /home/chris/Downloads/2016b_linux/R201 ...

  10. SQL Server索引维护

    索引维护的两个重要方面是索引碎片和统计信息. 一:索引碎片 降低碎片的产生,当索引上的页不在具有物理连续性时,就会产生碎片,下面的情景会产生碎片: INSERT操作.UPDATE操作.DBCC SHR ...