Exception in thread "main" org.hibernate.HibernateException: No CurrentSessionContext configured!
来源:互联网 发布:戏曲分类知乎 编辑:程序博客网 时间:2024/05/20 10:13
Hibernate使用缓存查询时报错:
Exception in thread "main" org.hibernate.HibernateException: No CurrentSessionContext configured!at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:1012)at com.mao.secondCache.NewManager.secondCacheTest(NewManager.java:44)at com.mao.secondCache.NewManager.main(NewManager.java:39)解决方案:
在hibernate.cfg.xnl中添加如下代码:
<!-- 指定根据当前线程来界定上下文相关Session --><property name="hibernate.current_session_context_class">thread</property>
重新运行一下就好了
0 0
- Exception in thread "main" org.hibernate.HibernateException: No CurrentSessionContext configured!
- Exception in thread "main" org.hibernate.HibernateException: No CurrentSessionContext configured!
- 错误:org.hibernate.HibernateException:No CurrentSessionContext configured!
- org.hibernate.HibernateException: No CurrentSessionContext configured!
- org.hibernate.HibernateException: No CurrentSessionContext configured
- 错误:org.hibernate.HibernateException: No CurrentSessionContext configured!
- org.hibernate.HibernateException: No CurrentSessionContext configured!
- org.hibernate.HibernateException: No CurrentSessionContext configured!
- org.hibernate.HibernateException: No CurrentSessionContext configured!
- 错误:org.hibernate.HibernateException: No CurrentSessionContext configured!
- org.hibernate.HibernateException: No CurrentSessionContext configured!
- org.hibernate.HibernateException: No CurrentSessionContext configured!
- 错误:org.hibernate.HibernateException: No CurrentSessionContext configured!
- org.hibernate.HibernateException: No CurrentSessionContext configured!
- org.hibernate.HibernateException: No CurrentSessionContext configured!
- org.hibernate.HibernateException: No CurrentSessionContext configured!
- org.hibernate.HibernateException: No CurrentSessionContext configured!
- hibernate异常org.hibernate.HibernateException: No CurrentSessionContext configured!
- Java学习笔记之ArrayList基本用法
- GBDT(MART) 迭代决策树入门教程 | 简介
- eclipse pydev 插件安装不显示问题
- 关于消息队列
- struts1中路径问题
- Exception in thread "main" org.hibernate.HibernateException: No CurrentSessionContext configured!
- 《Vim-初学设置行号样式》
- 289. Game of Life
- Android中使用Handler造成内存泄露的分析和解决
- zabbix server is running | No.解决方法
- Ionic
- php技术第二章
- oj题待改sumAaddB.c
- CEFGlue 加载FLASH 使用HOOK 方式 解决 CEF 加载 PPAPI FLASH 插件时弹出 CMD 命令行 窗口的问题