hibernate报错org.hibernate.SessionException: Session was already closed
org.hibernate.SessionException: Session was already closed
at org.hibernate.internal.SessionImpl.close(SessionImpl.java:411)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.hibernate.context.internal.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:338)
at com.sun.proxy.$Proxy25.close(Unknown Source)
at cn.itcast.hibernatetest.HibernateSelect.testTx01(HibernateSelect.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
使用了本地线程之后就不需要使用session.close()来关闭,把该语句去掉。
sessionFactory.getCurrentSession()
hibernate报错org.hibernate.SessionException: Session was already closed的更多相关文章
- Hibernate 报错org.hibernate.PropertyAccessException: IllegalArgumentException(已解决)
无聊想搭建一个项目,练手,做点小功能就一个卡在这个问题上 org.hibernate.PropertyAccessException: IllegalArgumentException occurre ...
- hibernate报错org.hibernate.HibernateException: No CurrentSessionContext configured!
org.hibernate.HibernateException: No CurrentSessionContext configured! at org.hibernate.internal.Ses ...
- Hibernate报错,关于配置的SessionFactory找不到问题
最近写项目使用hibernate默认的dtd,在启动项目时经常会出现这个问题,hibernate报错,配置factory的id找不到,找不到mapping配置文件, 不能读取配置的xml文件 Coul ...
- docker安装cloudera manager,切换cloudera-scm用户报错can not open session
在root帐号下su - cloudera-scm报错can not open session 在网上搜,大概是说ulimit超过限制之类,搞了很久才找到/etc/security/limits.d/ ...
- spring+hibernate整合:报错org.hibernate.HibernateException: No Session found for current thread
spring+hibernate整合:报错信息如下 org.hibernate.HibernateException: No Session found for current thread at o ...
- Hibernate报错:Caused by: java.sql.SQLException: Field 'ID' doesn't have a default value
问题一: 报错如下: org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assig ...
- Hibernate报错:org.hibernate.ObjectNotFoundException: No row with the given identifier exists 解决办法
报错信息: org.hibernate.event.internal.DefaultLoadEventListener onLoad INFO: HHH000327: Error performing ...
- hibernate报错Unknown integral data type for ids : java.lang.String
package com.model; // Generated 2016-10-27 14:02:17 by Hibernate Tools 4.3.1.Final /** * CmDept gene ...
- 【hibernate 报错】No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer 【get和load的区别】
报错: HTTP Status 500 - Could not write content: No serializer found for class org.hibernate.proxy.poj ...
随机推荐
- maven仓库添加本地jar
一.将jar添加到本地仓库的做法: 以下面pom.xml依赖的jar包为例: 实际项目中pom.xml依赖写法: <dependency> <groupId>org.sprin ...
- 对django模型中的objects的理解
object是模型属性,用于模型对象和数据库交互. object=Manager()是管理器类型的对象,是model和数据库进行查询的接口 可以自定义管理对象 books=models.Manager ...
- 基于apache —HttpClient的小爬虫获取网页内容
今天(17-03-31)忙了一下午研究webmagic,发现自己还太年轻,对于这样难度的框架(类库) 还是难以接受,还是从基础开始吧,因为相对基础的东西教程相多一些,于是乎我找了apache其下的 H ...
- js验证表单大全2
屏蔽右键 很酷 oncontextmenu="return false" ondragstart="return false"onselectstart=&q ...
- 洛谷 P2261 [CQOI2007]余数求和
洛谷 一看就知道是一个数学题.嘿嘿- 讲讲各种分的做法吧. 30分做法:不知道,这大概是这题的难点吧! 60分做法: 一是直接暴力,看下代码吧- #include <bits/stdc++.h& ...
- always on 技术
always on 技术系列:https://blog.csdn.net/dba_huangzj/article/details/54015470 MSSQL 2014 /WIN SERVER 200 ...
- windows 安装 python _ flask
1:首先安装python虚拟环境;(略) 2: 添加一个虚拟环境: 在你的项目目录里直接 virtualenv venv 启动虚拟环境;\venv\Scripts 直接运行activate 3: 在虚 ...
- jquery mobile 带参数跳转收集(紧个人使用,测试完会补全)
//临时存储 var TempCache = { cache:function(value){ localStorage.setItem("EasyWayTempCache",va ...
- 【WEB】前段优化
模块化管理: sea.js, require.js 压缩:r.js gulp.js, grunt.js 加速:cdn
- Python之函数2 嵌套,作用域和闭包(Day12)
一.函数对象 1.函数是第一类对象,即函数可以当做数据传递 1.1 可以被引用 1.2 可以当做参数传递 1.3 返回值可以是函数 1.4 可以当做容器类型的元素 二.函数的嵌套 1.函数嵌套的调用: ...