日志报错:java.lang.IlleagalArgumentExcption: entity not in the persistence context
来源:互联网 发布:php获取get数据 编辑:程序博客网 时间:2024/05/21 01:32
应用:开发一个定时器功能。需要从数据库select出所有的用户,之后for循环,对每个用户单独做处理。
报错的大致含义:传入的参数有问题,而这个问题是,传入的这个参数(实体对象)并不在持久化上下文里。
项目中,使用的框架为Hibernate。
实际上,作为方法传入值得参数(用户),在select出来后,由于对象状态的转变,导致对象不再是持久化。
以下链接为查找到的关于Hibernate管理下的对象的三种状态及其转化:
http://blog.csdn.net/fg2006/article/details/6436517
看到转化图中,当执行find( )时,对象应该是持久化的才对。所以估计是在调用findAll( ),findAll( )可能存在什么问题。
目前的解决方式,在外部方法上增加 @Transactional,就不会再继续报错了。
阅读全文
0 0
- 日志报错:java.lang.IlleagalArgumentExcption: entity not in the persistence context
- 百度地图API报错 Caused by: java.lang.IllegalStateException: you have not supplyed the global app context i
- 百度地图API报错 Caused by: java.lang.IllegalStateException: you have not supplyed the global app context i
- java.lang.NoClassDefFoundError: javax/persistence/Entity
- java.lang.ClassNotFoundException: javax.persistence.Entity
- java.lang.ClassNotFoundException: javax.persistence.Entity
- PHPExcel下载excel文件正常,打开报错:'break' not in the 'loop' or 'switch' context
- PHPExcel导出excel文件正常,打开报错:'break' not in the 'loop' or 'switch' context
- Caused by: java.lang.ClassNotFoundException: javax.persistence.Entity
- Caused by: java.lang.ClassNotFoundException: javax.persistence.Entity
- Hibernate3.3以上版本报Exception in thread "main" java.lang.NoClassDefFoundError: javax/persistence/Cacheable异常
- 报错:java.lang.IllegalArgumentException: Can not find a java.io.InputStream with the name [download
- tomcat启动不了报错: Publishing failed Could not publish to the server. java.lang.IndexOutOfBoundsException
- Tomcat服务器报错: Could not publish to the server. java.lang.NullPointerException
- 出现Could not publish to the server. java.lang.NullPointerException报错信息
- tomcat启动报错Could not publish to the server. java.lang.NullPointerException
- Hibernate java.lang.NoClassDefFoundError: javax.persistence.EntityListeners 报错问题所在
- struts和Hibernate整合,报错:java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z
- CSS3&HTML5各浏览器支持情况一览表
- SpringBoot整合Shiro
- SQL-用JOIN连接多个表
- 用Python函数实现求取一个正实数平方根的简单算法
- 回溯算法--收费公路重建问题
- 日志报错:java.lang.IlleagalArgumentExcption: entity not in the persistence context
- SICP随笔
- HTML5中的output标签
- HTML实现用户注册界面
- QGC的MainToolBarIndicator
- 1019(树状数组的区间更新,区间求和)
- U3D中模型后面加载2D背景(多相机分层显示 )
- HBase(1)-HBase的分布式安装
- JAVA获取远程文件