报错 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 ...
随机推荐
- 2009年NOIP提高组真题-HanKson的趣味题(GCD&LCM优化)
2009年NOIP提高组真题-HanKson的趣味题(GCD&LCM优化) 本题的编码是用Python实现的,C++的思路也是相同的. 希望本文能够帮助到你! 题目: 暴力法: 直接根据题目的 ...
- java跨越解决
1.配置文件解决跨域 使用Filter方式进行设置 @Slf4j @Component public class CorsFilter implements Filter { @Override pu ...
- CS144 计算机网络 Lab3:TCP Sender
前言 在 Lab2 中我们实现了 TCP Receiver,负责在收到报文段之后将数据写入重组器中,并回复给发送方确认应答号.在 Lab3 中,我们将实现 TCP 连接的另一个端点--发送方,负责读取 ...
- 痞子衡嵌入式:聊聊i.MXRT1xxx上第三级启动保障 - SDMMC manufacture模式
大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是i.MXRT1xxx上第三级启动保障 - SDMMC manufacture模式. 如果你在 i.MXRT1xxx 板卡上尝试过从 SD ...
- 2021-02-03:手写代码:KMP算法。
福哥答案2021-02-03: Knuth-Morris-Pratt 字符串查找算法,简称为 KMP算法,常用于在一个文本串 S 内查找一个模式串 P 的出现位置.这个算法由 Donald Knuth ...
- 2022-04-26:给定四个整数 sx , sy ,tx 和 ty,如果通过一系列的转换可以从起点 (sx, sy) 到达终点 (tx, ty),则返回 true,否则返回 false。 从点 (x
2022-04-26:给定四个整数 sx , sy ,tx 和 ty,如果通过一系列的转换可以从起点 (sx, sy) 到达终点 (tx, ty),则返回 true,否则返回 false. 从点 (x ...
- 【源码解读】asp.net core源码启动流程精细解读
引言 core出来至今,已经7年了,我接触也已经4年了,从开始的2.1,2.2,3.1,5,6再到如今的7,一直都有再用,虽然我是一个Winform仔,但是源码一直从3.1到7都有再看,然后在QQ上面 ...
- Windows 11 和 Rocky 9 Linux 平台 MySQL 8.0.33 简易安装教程
目录 Windows 平台安装 MySQL Linux 平台 Rocky 9 安装 MySQL binary package rpm package yum 源 source package Wind ...
- 2023-05-23:如果交换字符串 X 中的两个不同位置的字母,使得它和字符串 Y 相等, 那么称 X 和 Y 两个字符串相似。如果这两个字符串本身是相等的,那它们也是相似的。 例如,“tars“
2023-05-23:如果交换字符串 X 中的两个不同位置的字母,使得它和字符串 Y 相等, 那么称 X 和 Y 两个字符串相似.如果这两个字符串本身是相等的,那它们也是相似的. 例如,"t ...
- golang依赖注入工具digo
golang依赖注入工具 digo工具地址:https://github.com/werbenhu/digo 特性 使用注释中的注解 自动代码生成 自动检测循环依赖 编译时期依赖注入 自动初始化 支持 ...