org.hibernate.ObjectNotFoundException: No row with the given identifier exists

维护老系统时出现的问题,出现的原因我简述一下:
table1与table2是关联表,T1中有T2的主键 "T1_id",当T1中的 "T2_id" 不为null时,而T2中的"T2_id"为空,那么就会报上面这个错。
反之T1的"T2_id"为null,而T2中的"T2_id"不为null,没有任何影响。
所以这个错误是由于数据不匹配出现的。
解决方案:
1.在映射文件里加上 not-found="ignore" ,这个方法我是百度到的,按道理是没问题的,但是没有生效,可以一试

2.根据console中给出的信息,去排查相关表的主外键信息是否有问题。
比如我的console中是 :org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.fpscc.model.UserAuthInfo#409]
我去数据库中查了下,User_Auth_Info_id中没有 409 这一条数据,而另外一个和它有关联的表中的"User_Auth_Info_id"是有 409 这一条数据的,
所以我稍微改动了下,就正常了。
org.hibernate.ObjectNotFoundException: No row with the given identifier exists的更多相关文章
- 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: [com.zhuoshi.entity.Dep#1]
报错信息: org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.zhuoshi.e ...
- 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 ...
随机推荐
- 5、Storm集成Kafka
1.pom文件依赖 <!--storm相关jar --> <dependency> <groupId>org.apache.storm</groupId> ...
- JDK源码分析(12)之 ConcurrentHashMap 详解
本文将主要讲述 JDK1.8 版本 的 ConcurrentHashMap,其内部结构和很多的哈希优化算法,都是和 JDK1.8 版本的 HashMap是一样的,所以在阅读本文之前,一定要先了解 Ha ...
- vue3.0使用axios报错问题记录
vue-cli3.0使用axios的时候出现错误,记录一下 报错信息: Uncaught TypeError: Cannot set property $axios of #<Vue> w ...
- arch安装以及配置记录
设置ip和网关 ifconfig eth0 10.82.16.233 netmask 255.255.255.0 route add default gw 10.82.16.1 或者 ip addr ...
- 最大子段和的DP算法设计及其效率测试
表情包形象取自番剧<猫咪日常> 那我也整一个 曾几何时,笔者是个对算法这个概念漠不关心的人,由衷地感觉它就是一种和奥数一样华而不实的存在,即便不使用任何算法的思想我一样能写出能跑的程序 直 ...
- mongodb常用的sql语句总结
本文为博主原创,转载请注明出处: 1 . 查询所有 db.getCollection('CollectionName').find() 2.根据条件查询 db.getCollection('Coll ...
- Ubuntu 下生成 python 环境安装文件 requirements.txt
参考: 查找python项目依赖并生成requirements.txt Ubuntu 下生成 python 环境安装文件 requirements.txt 首先通过 pip 安装pyreqs模块: p ...
- RN截图并且下载问题
神奇的BUG一大堆. 需求-->截图并且下载图片 实现: import ViewShot from "react-native-view-shot"; CameraRoll ...
- Antd-Pro2.0版本如何修改代理,让Mock变为真实服务器接口
Antd-pro2.0之前更改代理方式 更改.roadhogrc.mock.js export default { 'GET /api/*': 'http://localhost:8001/', 'P ...
- 51nod 1405 树的距离之和 树形dp
1405 树的距离之和 基准时间限制:1 秒 空间限制:131072 KB 收藏 关注 给定一棵无根树,假设它有n个节点,节点编号从1到n, 求任意两点之间的距离(最短路径)之和. Input ...