Hibernate报错:org.hibernate.ObjectNotFoundException: No row with the given identifier exists 解决办法
报错信息:
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 解决办法的更多相关文章
- 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: [com.zhuoshi.entity.Dep#1]
报错信息: org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.zhuoshi.e ...
- 搭建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 ...
- (转)启动网卡报错(Failed to start LSB: Bring up/down networking )解决办法总结
启动网卡报错(Failed to start LSB: Bring up/down networking )解决办法总结 原文:http://blog.51cto.com/11863547/19059 ...
- MySQL8.0报错Can't connect to MySQL server on 'localhost' (10061)的解决办法
MySQL8.0报错Can't connect to MySQL server on 'localhost' (10061)的解决办法 事情的起因 今天课堂上要展示小组项目,需要用一个软件叫W ...
- Hibernate 报错org.hibernate.PropertyAccessException: IllegalArgumentException(已解决)
无聊想搭建一个项目,练手,做点小功能就一个卡在这个问题上 org.hibernate.PropertyAccessException: IllegalArgumentException occurre ...
- org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [cn.facekee.cms.entity.CmsFansgroup#195]
刚开始报错还是报的稀奇古怪的错误,让我纠结了好久,再三检查报错的位置,发现并没有错误,最后认真分析查看每行报错的信息才找到如题所述的错误!!!!! 报这种错误的原因可能是POJO映射文件中的字段和数据 ...
- 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 ...
随机推荐
- Windows MFC 两个OpenGL窗口显示与线程RC问题
问题为:背景界面是一个OpenGL窗口(对话框),在其上弹出一个OpenGL窗口(模态对话框)时, 1.上方的OpenGL窗口能响应鼠标操作等并刷新: 2.当移动或放大缩小上方的OpenGL窗口时,其 ...
- (转)关于URLDownloadToFile下载文件
转自:http://zhouhaijiang3.blog.163.com/blog/static/43477220200931981322497/ 在下载文件时,下载文件的目录大小写要注意和虚拟目录的 ...
- 网站压力测试工具webbench使用说明
一.webbench简介 Webbench是有名的网站压力测试工具,它是由Lionbridge公司(http://www.lionbridge.com)开发.它的帮助文件和文档请到:ww ...
- Git--分布式版本控制系统
使用Git实现多人协作开发 1.简述 每创建一个大的web项目都会有团队协作完成, 然这个过程有可能就像毕业生写论文的过程, 这个过程会有很多...修改的版本, 我们的项目也是会经过无休止的改需求, ...
- Could not parse mapping document from input stream hibernate配置异常
十二月 , :: 下午 org.apache.catalina.core.StandardContext listenerStart SEVERE: Exception sending context ...
- NNVM打造模块化深度学习系统(转)
[摘录理由]: 之所以摘录本文,主要原因是:该文配有开源代码(https://github.com/dmlc/nnvm):读者能够直接体会文中所述的意义,便于立刻展开研究. MXNet专栏 :NNVM ...
- thinkPHP-空操作
空操作 当访问的方法不存在时,可以定义一个empty方法来避免空操作 function _empty() { echo "网页不存在,请检查地址信息"; } 这样当访问不存在的方法 ...
- iOS GCD, 同步,异步,串行队列,并行队列,dispatch_group
同步,指代码在同一个线程运行 异步,代码在另一个线程运行 串行队列,提交到该队列的block会顺序执行 并行队列,提交到该队列的block会并发执行 如果想等某一队列中所有block都执行完了在执行一 ...
- 去掉IE下input的叉号
IE10下的Input Text和谷歌下面的 input search 一旦输入内容,会在最右端出现一个叉号,点击后,内容就会自动清空,看似方便,其实有些场景并不需要,需要写代码清除掉. 代码如下: ...
- WEB测试方法及注意地方
1页面部分(1) 页面清单是否完整(是否已经将所需要的页面全部都列出来了)(2) 页面是否显示(在不同分辨率下页面是否存在,在不同浏览器版本中页面是是否显示)(3) 页面在窗口中的显示是否正确.美观( ...