org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.zhuoshi.entity.Dep#1]
报错信息:
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.zhuoshi.entity.Dep#1]
报错分析:
Hibernate的映射文件,表A里关联了表B的主键,当查询表A时,在B表里找不到对应记录时就会报错,如果只是逻辑删除不会报这种错误,
只有当表B里测试没有id为15的这条数据了才会报错(已实际测试过);上面报错信息实体类后面【#15】表示实体类对应表id=15的记录找不到。也就是存在垃圾数据,可能是因为没有连带删除。 解决办法:
1. 修改配置文件加上 not-found="ignore" ”
即:
<many-to-one name="adminusers" class="com.weixin.db.model.Adminusers"
fetch="select" lazy="false" not-found="ignore">
2.修改数据库中的垃圾信息
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.zhuoshi.entity.Dep#1]的更多相关文章
- Hibernate报错:org.hibernate.ObjectNotFoundException: No row with the given identifier exists 解决办法
报错信息: org.hibernate.event.internal.DefaultLoadEventListener onLoad INFO: HHH000327: Error performing ...
- org.hibernate.ObjectNotFoundException: No row with the given identifier exists解决办法
hibernate-取消关联外键引用数据丢失抛异常的设置@NotFound hibernate项目里面配了很多many-to-one的关联,后台在查询数据时已经作了健全性判断,但还是经常抛出对象找不到 ...
- org.hibernate.ObjectNotFoundException: No row with the given identifier exists
维护老系统时出现的问题,出现的原因我简述一下: table1与table2是关联表,T1中有T2的主键 "T1_id",当T1中的 "T2_id" 不为null ...
- org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [cn.facekee.cms.entity.CmsFansgroup#195]
刚开始报错还是报的稀奇古怪的错误,让我纠结了好久,再三检查报错的位置,发现并没有错误,最后认真分析查看每行报错的信息才找到如题所述的错误!!!!! 报这种错误的原因可能是POJO映射文件中的字段和数据 ...
- Hibernate常见问题 No row with the given identifier exists问题的解决办法及解决
(1)在学习Hibernate的时候遇到了这个问题"No row with the given identifier exists"在网上一搜看到非常多人也遇到过这个问题! 问题的 ...
- 关于Hibernate中No row with the given identifier exists问题的原因及解决
今天遇到一个bug,截图如下 有两张表,table1和table2.产生此问题的原因就是table1里做了关联<one-to-one>或者<many-to-one unique=&q ...
- Hibernate错误——No row with the given identifier exists
错误 是用的是Hibernate自动建立的数据表,在进行数据库操作时,出现错误No row with the given identifier exists 解决 关系数据库一致性遭到了破坏,找到相关 ...
- (转)收集:Hibernate中常见问题 No row with the given identifier exists问题的原因及解决
Hibernate中No row with the given identifier exists问题的原因及解决 产生此问题的原因: 有两张表,table1和table2.产生此问题的原因就是tab ...
- Hibernate中常见问题 No row with the given identifier exists问题
收集:Hibernate中常见问题 No row with the given identifier exists问题的原因及解决 2007年11月21日 15:02:00 eyejava 阅读数:2 ...
随机推荐
- 记录Sql2012附加Sql2008的数据库出错的解决方案
只需要对要附加的数据文件[右键]->[属性]->[安全]->(选择“Authenticated Users”用户)[编辑]->让“Authenticated Users”用户具 ...
- mac os x 编译spark-2.1.0 for hadoop-2.7.3
mac os x maven编译spark-2.1.0 for hadoop-2.7.3 1.官方文档中要求安装Maven 3.3.9+ 和Java 8 ; 2.执行 export ...
- 解决ajax跨域
今天要联调项目,前后端请求使用ajax,联调存在跨域问题,解决办法如下: (1)在本地的电脑上新建一个文件夹,用于前后端联调存放浏览器 缓存的 (2)打开桌面的谷歌浏览器图标(右键>属性> ...
- 合并多个Excel
合并excel分为两种情况:1.将多个excel文件合并在一个excel中的不同sheet中.2.将多个excel文件合并在一个excel文件的一个sheet中. 1.将多个excel的文件合并在一个 ...
- WCF服务无法访问DateTime类型的解决方法
在WCF服务中,如果entity类含有DateTime类型的字段,那么接口将会被执行两次,从而出现无法访问的情况.如下图所示: 原因是WCF中DateTime无法转换成序列化JSON字符串,DateT ...
- 学号 20175212 《Java程序设计》第3周学习总结
学号 20175212 <Java程序设计>第3周学习总结 教材学习内容总结 一. Java--面向对象语言 核心内容为对象,一切围绕着对象.以下为三个重要性质: 封装性:将数据和对数据的 ...
- 乐观锁vs悲观锁, 集群vs分布式 , 微服务, 幂等性
乐观锁: 总认为不会产生并发问题,因此不会上锁,更新时会判断其他线程在这之前有没有对数据进行修改,一般会使用版本号机制或CAS操作来实现 version: 数据上有数据版本号version字段,每次更 ...
- FtpWebRequest.UsePassive属性:设置FTP工作模式
默认值:true,被动模式 PASV(被动)方式的连接过程是:客户端向服务器的FTP端口(默认是21)发送连接请求,服务器接受连接,建立一条命令链路. 当需要传送数据时, 服务器在命令链路上用PASV ...
- MySql数据库通过idb和frm恢复
简单粗暴 恢复user表 1.先建立和之前user表一样的表结构.就是执行create table user .... ,执行完,数据库目录下就会建立user.ibd文件(当然还有其他的) 2.执行 ...
- ubuntu 服务restart失败
在ubuntu使用时碰到的一个问题,修改了nginx服务的配置文件后,重启服务,显示 * Restarting nginx nginx ...