码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2017-11-10 15:19:55      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:技术   ble   技术分享   image   http   ber   exce   model   不为   

技术分享

    维护老系统时出现的问题,出现的原因我简述一下:

         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

标签:技术   ble   技术分享   image   http   ber   exce   model   不为   

原文地址:http://www.cnblogs.com/hjzcy1314/p/7814376.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!