报错信息:

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

    看了一篇相关的文章,感觉还不错,链接http://www.cnblogs.com/lwbqqyumidi/p/3775479.html

  2. pip install 报错原因

    1. 要在~/.pip/pip.conf中添加源的地址. 2. 在运行pip install 命令的时候加上sudo -H

  3. ionic tabs置顶

    找了好久怎么解决这问题,终于找到了一哥们留下来的经验,万分感谢,特此拷贝过来,留着下次以免忘记 我在主页ion-nav-bar元素上添加hide-nav-bar=“true”;然后又在ion-view ...

  4. firebug常用工具

    1.console.group("第一组"); console.log(1); console.groupend(); 2.console.dir(对象);//输出对象的所有信息 ...

  5. MSMQ消息队列 用法

    引言 接下来的三篇文章是讨论有关企业分布式开发的文章,这三篇文章筹划了很长时间,文章的技术并不算新,但是文章中使用到的技术都是经过笔者研究实践后总结的,正所谓站在巨人的肩膀上,笔者并不是巨人,但也希望 ...

  6. delpin常用函数

    if  r>570 then                  SET_TT(1);//超出多少行就用excel导出 类似数组用法:var        ts: TStringlist;begi ...

  7. Ubuntu 12.04搭建l2tp服务器记录。

    1. 安装openswan apt-get install openswan 2.打开 /etc/ipsec.conf 文件,做如下配置: 其中,virtual_privat这里包含的网络地址允许配置 ...

  8. Image 抠图,背景透明处理

    import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.io.File; import javax.i ...

  9. Javascript 中 == 和 === 区别

    转载几张图片,说明其中的具体意义 这是 == 这是 === 完整比较图: 红色:=== 橙色:== 黄色:<= 和 >= 同时成立,== 不成立 蓝色:只有 >= 绿色:只有 < ...

  10. 自己实现多线程的socket,socketserver源码剖析

    1,IO多路复用 三种多路复用的机制:select.poll.epoll 用的多的两个:select和epoll 简单的说就是:1,select和poll所有平台都支持,epoll只有linux支持2 ...