报错信息:

org.hibernate.event.internal.DefaultLoadEventListener onLoad
INFO: HHH000327: Error performing load command : org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.weixin.db.model.Adminusers#15]

报错分析:

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. 要么就把垃圾数据从数据库删掉。

项目中遇到的问题,记录一下。

Hibernate报错:org.hibernate.ObjectNotFoundException: No row with the given identifier exists 解决办法的更多相关文章

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

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

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

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

  3. 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 ...

  4. 搭建elsticsearch集群 报错with the same id but is a different node instance解决办法

    搭建elsticsearch集群 报错with the same id but is a different node instance解决办法 学习了:https://blog.csdn.net/q ...

  5. (转)启动网卡报错(Failed to start LSB: Bring up/down networking )解决办法总结

    启动网卡报错(Failed to start LSB: Bring up/down networking )解决办法总结 原文:http://blog.51cto.com/11863547/19059 ...

  6. MySQL8.0报错Can't connect to MySQL server on 'localhost' (10061)的解决办法

    MySQL8.0报错Can't connect to MySQL server on 'localhost' (10061)的解决办法 事情的起因     今天课堂上要展示小组项目,需要用一个软件叫W ...

  7. Hibernate 报错org.hibernate.PropertyAccessException: IllegalArgumentException(已解决)

    无聊想搭建一个项目,练手,做点小功能就一个卡在这个问题上 org.hibernate.PropertyAccessException: IllegalArgumentException occurre ...

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

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

  9. CURL命令报错:dyld: lazy symbol binding failed: Symbol not found: _SSL_load_error_strings解决办法

    Mac OS X 10.11.6, curl 命令报错,错误如下: dyld: lazy symbol binding failed: Symbol not found: _SSL_load_erro ...

随机推荐

  1. chadang saidui

    http://www.freehacktools.com/   wen http://www.hackyshacky.com/2013/02/Must-have-hacking-tools.html  ...

  2. 在windows编译MariaDB

    OS: Windows XP sp3 IDE: VS2010 MariaDB: V5.5 (到目前为止2016.5,中文域(.cn)只有清华大学 TUNA 镜像源可用) (.tar.gz为源码:.zi ...

  3. IOS 中openGL使用教程3(openGL ES 入门篇 | 纹理贴图(texture)使用)

    在这篇文章中,我们将学习如何在openGL中使用纹理贴图. penGL中纹理可以分为1D,2D和3D纹理,我们在绑定纹理对象的时候需要指定纹理的种类.由于本文将以一张图片为例,因此我们为我们的纹理对象 ...

  4. 关于python中文件导入的若干问题

    __init__文件 同一级目录下直接import导入就可以了,如果是在不同的目录下面被导入文件的文件夹下面必须有__init__.py文件,即使这个文件是空的也可以.当然这个文件也可以初始一些数据 ...

  5. pycharm激活码,拿走不谢

    激活码 新下载pycharm编辑器以后,会遇到一个激活的问题,否则只能试用30天 43B4A73YYJ-eyJsaWNlbnNlSWQiOiI0M0I0QTczWVlKIiwibGljZW5zZWVO ...

  6. Sublime Text 3 引用插件

    汉化插件 点击 View> Show Console 输入import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b ...

  7. 普通图片预览及demo(非分块)

    演示地址: http://codeman35.itongyin.com:19003/v2/image.html 功能:通过加载大图预览,这种方式无法和google art 比较.只能应用于简单的图片预 ...

  8. Socket原理与编程基础

    一.Socket简介 Socket是进程通讯的一种方式,即调用这个网络库的一些API函数实现分布在不同主机的相关进程之间的数据交换. 几个定义: (1)IP地址:即依照TCP/IP协议分配给本地主机的 ...

  9. 小知识:Python函数传递变长

    先来实践一把: def f1(*args): print(args) f1(1,2,3,4) 得出:(1, 2, 3, 4) ----- 是一个元祖 Part 1: *args可以传递任意多的数,ar ...

  10. js中各种事件的兼容性

    1给元素绑定一个事件 ie8attachEvent(on+"事件",event); 高级浏览器 addEventListener("事件",event,fals ...