报错 no currentsessioncontext configured!
no currentsessioncontext configured!
使用hibernate框架报错
配置了session工厂类,使用getCurrentSession();时候引起的,原因是currentSession配置错误
当我们使用currentSession的时候需要在hibernate.cfg.xml中进行如下事务配置:
1、如果是本地事务:
<property name="hibernate.current_session_context_class">thread</property>
2、如果是全局事务
<property name="hibernate.current_session_context_class">jta</property>
如果获得session 对象使用 sessionFactory.openSession()就不会出现这个错误了。
openSession()是不管任何情况都重新开启一个Session,而getCurrentSession();相对的增加了一个判断,在有Session的情况下就会直接去调用,没有session的话才会创建,如果有事务操作的话getCurrentSession();更好一些,很容易的使得一个线程只有一个session对象。
报错 no currentsessioncontext configured!的更多相关文章
- pycurl mac 安装报错Curl is configured to use SSL,
1.使用安装第三方插件的方式安装pycurl:pip3 install pycurl 报错提示如下: Curl is configured to use SSL, but we have not be ...
- 使用Quartz任务调用的时候报错Based on configured schedule, the given trigger will never fire.
org.quartz.SchedulerException: Based on configured schedule, the given trigger will never fire. 大概意思 ...
- 【已解决】将jsp文件在浏览器打开直接出现代码,在浏览器出现本地地址,tomcat报错
问题背景: 导入了一个项目直接打开可以,但是想跟一遍代码,把配置文件全部整理成为一个springmvc的基础配置文件 跟着配置到自己tomcat就不管怎样都是下面的截图 希望可以帮到一起报错的朋友快 ...
- hibernate报错org.hibernate.HibernateException: No CurrentSessionContext configured!
org.hibernate.HibernateException: No CurrentSessionContext configured! at org.hibernate.internal.Ses ...
- .NET CORE 使用Session报错:Session has not been configured for this application or request
报错信息:Session has not been configured for this application or request 解决方案:在Startup.cs文件中的Configure方法 ...
- gitkraken clone报错 Configured SSH key is invalid
gitkraken clone远程仓库时报错 Configured SSH key is invalid. Please confirm that is properly associated wit ...
- laravel 项目表单中有csrf_token,但一直报错419错误 解决redis连接错误:MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persi
laravel 项目表单中有csrf_token,但一直报错419错误,因为项目中使用到Redis缓存,在强制关闭Redis后出现的问题,查询laravel.log文件查找相关问题 安装redis后在 ...
- django中执行py报错Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured
https://blog.csdn.net/heybob/article/details/49684261 django代码下面直接run的时候报错: django.core.exceptions.I ...
- django调用py报错 django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured.
完整报错信息如下 django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, bu ...
- eclipse egit 报错 The current branch is not configured for pull No value for key branch.master
eclipse egit 插件 pull报错 The current branch is not configured for pull No value for key branch.master ...
随机推荐
- 中国省市区--地区SQL表
SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for rc_district -- ---- ...
- Semantic Kernel 入门系列:🥑Memory内存
了解的运作原理之后,就可以开始使用Semantic Kernel来制作应用了. Semantic Kernel将embedding的功能封装到了Memory中,用来存储上下文信息,就好像电脑的内存一样 ...
- MySQL-带你上官网看索引
在我之前的一篇文章中,有引用一个讨论用Hash还是Tree的问题,DB中关于查找类数据结构,除了树,还有Hash(HashMap,HashSet). 存储数据结构之争 B+树主要是照顾磁盘IO这种特殊 ...
- 关于java中的equal
正常情况下的equal方法是比较两者之间的id.如果需要它实现其他的问题,可以通过重写这个方法.idea自带了重写equal的快捷方式.右键生成中的equals() 和 hashCode()就可以帮助 ...
- Golang每日一库之regex
本文地址: https://www.cnblogs.com/zichliang/p/17387436.html Golang日库合集:https://www.cnblogs.com/zichliang ...
- celery+Rabbit MQ简单的Demo
介绍 一个简单的celery + rabbitmq 的搭建例子,用于记录 Celery 异步处理框架, 安装命令 pip install celery RabbitMQ 消息中间件,用来做队列 安装配 ...
- 2023-03-03:请用go语言调用ffmpeg,摄像头捕获并编码为h264文件,不管音频。
2023-03-03:请用go语言调用ffmpeg,摄像头捕获并编码为h264文件,不管音频. 答案2023-03-03: 使用 github.com/moonfdd/ffmpeg-go 库. 先用如 ...
- 2022-06-12:在N*N的正方形棋盘中,有N*N个棋子,那么每个格子正好可以拥有一个棋子。 但是现在有些棋子聚集到一个格子上了,比如: 2 0 3 0 1 0 3 0 0 如上的二维数组代表,一
2022-06-12:在NN的正方形棋盘中,有NN个棋子,那么每个格子正好可以拥有一个棋子. 但是现在有些棋子聚集到一个格子上了,比如: 2 0 3 0 1 0 3 0 0 如上的二维数组代表,一共3 ...
- 2021-05-26:给定一个char[][] matrix
2021-05-26:给定一个char[][] matrix,也就是char类型的二维数组,再给定一个字符串word,可以从任何一个某个位置出发,可以走上下左右,能不能找到word?char[][] ...
- Go开源世界主流成熟ORM框架gorm实践分享
@ 目录 概述 定义 核心功能 声明模型与约定 gorm.Model 字段级权限 时间惯例 嵌入结构 字段标签 使用 安装 数据库链接 连接池 CRUD 接口 创建 查询 高级查询 修改 删除 原始S ...