报错信息:

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]的更多相关文章

  1. Hibernate报错:org.hibernate.ObjectNotFoundException: No row with the given identifier exists 解决办法

    报错信息: org.hibernate.event.internal.DefaultLoadEventListener onLoad INFO: HHH000327: Error performing ...

  2. org.hibernate.ObjectNotFoundException: No row with the given identifier exists解决办法

    hibernate-取消关联外键引用数据丢失抛异常的设置@NotFound hibernate项目里面配了很多many-to-one的关联,后台在查询数据时已经作了健全性判断,但还是经常抛出对象找不到 ...

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

    维护老系统时出现的问题,出现的原因我简述一下: table1与table2是关联表,T1中有T2的主键 "T1_id",当T1中的 "T2_id" 不为null ...

  4. org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [cn.facekee.cms.entity.CmsFansgroup#195]

    刚开始报错还是报的稀奇古怪的错误,让我纠结了好久,再三检查报错的位置,发现并没有错误,最后认真分析查看每行报错的信息才找到如题所述的错误!!!!! 报这种错误的原因可能是POJO映射文件中的字段和数据 ...

  5. Hibernate常见问题 No row with the given identifier exists问题的解决办法及解决

    (1)在学习Hibernate的时候遇到了这个问题"No row with the given identifier exists"在网上一搜看到非常多人也遇到过这个问题! 问题的 ...

  6. 关于Hibernate中No row with the given identifier exists问题的原因及解决

    今天遇到一个bug,截图如下 有两张表,table1和table2.产生此问题的原因就是table1里做了关联<one-to-one>或者<many-to-one unique=&q ...

  7. Hibernate错误——No row with the given identifier exists

    错误 是用的是Hibernate自动建立的数据表,在进行数据库操作时,出现错误No row with the given identifier exists 解决 关系数据库一致性遭到了破坏,找到相关 ...

  8. (转)收集:Hibernate中常见问题 No row with the given identifier exists问题的原因及解决

    Hibernate中No row with the given identifier exists问题的原因及解决 产生此问题的原因: 有两张表,table1和table2.产生此问题的原因就是tab ...

  9. Hibernate中常见问题 No row with the given identifier exists问题

    收集:Hibernate中常见问题 No row with the given identifier exists问题的原因及解决 2007年11月21日 15:02:00 eyejava 阅读数:2 ...

随机推荐

  1. 8.4 GOF设计模式三: 外观模式 Facade

    GOF设计模式三: 外观模式 Facade  “现有系统”功能强大.复杂,开发“新系统”需要用到其中一部分,但又要增加一部 分新功能,该怎么办?4.1 Facade Pattern: Key Fea ...

  2. 『计算机视觉』YOLO系列总结

    网络细节资料很多,不做赘述,主要总结演化思路和解决问题. 一.YOLO 1.网络简介 YOLO网络结构由24个卷积层与2个全连接层构成,网络入口为448x448(v2为416x416),图片进入网络先 ...

  3. activiti-用户与用户组

    https://my.oschina.net/acitiviti/blog/283892 activiti学习笔记3-用户与用户组 收藏 安世博 发表于 3年前 阅读 5507 收藏 10 点赞 0 ...

  4. Python3爬虫系列:理论+实验+爬取妹子图实战

    Github: https://github.com/wangy8961/python3-concurrency-pics-02 ,欢迎star 爬虫系列: (1) 理论 Python3爬虫系列01 ...

  5. HIT2019春软件构造->正则表达式语法

    普通字符:匹配与之相同的字符        字母.数字.汉字.下划线.没有特殊定义的标点符号. 简单的转义字符: \n 换行符 \t 制表符 \\ 代表\本身 \^,\$,\.,\(,\),\{,\} ...

  6. 设置position(absolute,fixed)导致flex布局不生效

    个人解决办法:将要设置display:flex的dom外面在套一个div,并且设置宽度,就可以了.

  7. 用EPPlus 读取excel,代码出错, the given key is not present in the dictionary

    using (ExcelPackage ep = new ExcelPackage(new FileInfo(path))) { ExcelWorksheet ws = ep.Workbook.Wor ...

  8. Linux系统启动过程(通俗易懂)

    前言: Linux是一种自由和开放源代码的类UNIX操作系统.该操作系统的内核由林纳斯·托瓦兹在1991年10月5日首次发布.在加上用户空间的应用程序之后,成为Linux操作系统.Linux是自由软件 ...

  9. 关于angular 的路由title设置

    在主模块下 constructor( private router: Router, private activatedRoute: ActivatedRoute, ) {} this.router. ...

  10. font awesome 页面小图标

    font awesome 页面小图标 前段时间做页面,从网上查找资料,发现了一个好用的工具,就是font awesome奥森图标,使用了一下,发现非常方便,而且很灵活,纯css编写,可以和bootst ...