报错 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 ...
随机推荐
- 研发运维双管齐下!Seal AppManager的正确打开方式
新一代应用统一部署管理平台 Seal AppManager 采用平台工程的理念,通过降低基础设施操作的复杂度为研发和运维团队提供易用.一致的应用管理和部署体验.Seal AppManager 帮助研发 ...
- RDIFramework.NET WinForm版新增通知公告、系统新闻模块
1.系统新闻功能描述 系统新闻模块,用户可以根据实际情况做相应应用,如用在内部业务系统的展示中或网站上新闻的展示.新闻可以分类进行管理,非常的实用.系统新闻管理主要分为添加.修改.删除与移动系统新闻. ...
- 使用Vue.js实现文字跑马灯效果
实现文字跑马灯效果,首先用到 substring()截取 和 setInterval计时器 clearInterval()清除计时器 效果如下: 实现代码如下: <!DOCTYPE html&g ...
- 30-externals(拒绝某些包被打包进来)
const { resolve } = require('path') const HtmlWebpackPlugin = require('html-webpack-plugin') module. ...
- react项目使用less样式,配置less
create-react-app脚手架创建的项目有sass配置项,使用的时候只需要装包即可,下面是less使用的方法 由于 create-react-app 脚手架中并没有配置关于 less 文件的解 ...
- flink之Sink to MySQL和Redis
前言 下面这篇文章是使用Flink的Sink 写出数据到Redis和MySQL Flink之Sink写入Redis和MySQL Flink需要添加Sink的时候,需要自己去添加写Sink,我们可以实现 ...
- Java的对象包装器 & 自动装箱
有时,需要将 int 这样的基本类型转换为对象.所有的基本类型都有一个与之对应的类.例如,Integer 类对应基本类型 int.通常,这些类被称为包装器(wrapper).这些对象包装器类拥有很明显 ...
- golang中一种不常见的switch语句写法
最近翻开源代码的时候看到了一种很有意思的switch用法,分享一下. 注意这里讨论的不是typed switch,也就是case语句后面是类型的那种. 直接看代码: func (s *systemd) ...
- Pwn系列之Protostar靶场 Stack3题解
(gdb) disass main Dump of assembler code for function main: 0x08048438 <main+0>: push ebp 0x08 ...
- 2023-03-14:读取摄像头,并且显示视频。代码用go语言编写。
2023-03-14:读取摄像头,并且显示视频.代码用go语言编写. 答案2023-03-14: 大体流程如下: 导入所需的库和包. 初始化 ffmpeg 和 SDL2 库. 打开摄像头并创建 AVF ...