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 ...
随机推荐
- springboot+thymeleaf+pageHelper带条件分页查询
html层 <div> <a class="num"><b th:text="'共 '+ ${result.resultMap['pages ...
- SQL Server2017还原数据库时指定mdf文件及日志文件的名称
由于需要还原同一个数据库的不同备份到不同数据库中,可是在还原的时候,可是在指定目标数据库时,填写不同的数据库名称,在SQL Server Data文件夹中生成的.mdf文件还是同一个,如图,虽然是很简 ...
- asp.net 获取网站根目录总结
.CSHttpContext.Current.Server.MapPath();//所在文件夹路径System.Web.HttpContext.Current.Request.PhysicalAppl ...
- Mybatis学习之一
mybatis是目前市面上最流行的ORM框架之一,作为JavaEE程序员,在工作中不可能不用到mybatis.所以为了工作,为了学习,为了个人的发展,每个JavaEE程序员都要学习,学会mybatis ...
- Go-单元测试
文章转载地址:https://www.flysnow.org/2017/05/16/go-in-action-go-unit-test.html 什么是单元测试? 单元测试一般用来测 ...
- Java发送邮件 —— SpringBoot集成Java Mail
用途:此文仅供,自己今后的小程序通过邮件,批量通知用户. 简单记录了一些发送基本邮件的操作. 项目(SpringBoot版本为2.1.2.RELEASE): 核心依赖(其他相关依赖,在其使用的地方具体 ...
- heartbeat 非联网安装(通过配置本地yum文件库安装heartbeat)
软件环境:centos6.5 一.下载rpm包 首先找一台联网的centos6.5机器 安装epel扩展源: yum install -y epel-release 安装yum-plugin-down ...
- Halcon 标定与准确测量
- 第 10 章 容器监控 - 080 - Weave Scope 容器地图
Weave Scope 容器地图 Weave Scope 的最大特点是会自动生成一张 Docker 容器地图,让我们能够直观地理解.监控和控制容器. 安装 执行如下脚本安装运行 Weave Scope ...
- printf打印输出
int PrintVal = 9; /*按整型输出,默认右对齐*/ printf("%d\n",PrintVal); /*按整型输出,补齐4位的宽度,补齐位为空格 ...