hibernate出现No row with the given identifier exists问题的产生原因及解决方法
来源:互联网 发布:错生网络剧娟姐 编辑:程序博客网 时间:2024/06/10 21:38
产生此问题的原因:
有两张表,table1和table2.产生此问题的原因就是table1里做了关联<one-to-one>或者<many-to-one>来关联table2.当hibernate查找的时候,table2里的数据没有与table1相匹配的,这样就会报No row with the given identifier exists这个错.(一句话,就是数据的问题!)
假如说,table1里有自身的主键id1,还有table2的主键id2,这两个字段.
如果hibenrate设置的单项关联,即使table1中的id2为null值,table2中id2中有值,查询都不会出错.但是如果table1中的id2字段有值,但是这个值在table2中主键值里并没有,就会报上面的错!
如果hibernate是双向关联,那么table1中的id2为null值,但是table2中如果有值,就会报这个错.这种情况目前的解决办法就是改成单项关联,或者把不对应的数据改对!
解决方法:
1.修改数据使关联字段能查询到数据
2.在<many-to-one>中设置not-found="ignore",此时如果关联关系不存在,对应的属性值为Null.
0 0
- hibernate出现No row with the given identifier exists问题的产生原因及解决方法
- Nhibernate出现No row with the given identifier exists问题的产生原因及解决方法
- Hibernate中No row with the given identifier exists问题的原因及解决
- Hibernate中No row with the given identifier exists问题的原因及解决
- 收集:Hibernate中常见问题 No row with the given identifier exists问题的原因及解决
- Hibernate中常见问题 No row with the given identifier exists问题的原因及解
- Hibernate中No row with the given identifier exists问题的原因及解决
- Hibernate中常见问题 No row with the given identifier exists问题的原因及解决
- Hibernate中常见问题 No row with the given identifier exists问题的原因及解决
- 收集:Hibernate中常见问题 No row with the given identifier exists问题的原因及解决
- 收集:Hibernate中常见问题 No row with the given identifier exists问题的原因及解决
- :Hibernate中常见问题 No row with the given identifier exists问题的原因及解决 .
- 收集:Hibernate中常见问题 No row with the given identifier exists问题的原因及解决
- Hibernate中No row with the given identifier exists问题的原因及解决
- 收集:Hibernate中常见问题 No row with the given identifier exists问题的原因及解决 .
- 收集:Hibernate中常见问题 No row with the given identifier exists问题的原因及解决
- Hibernate:No row with the given identifier exists问题的原因及解决
- Hibernate中常见问题 No row with the given identifier exists问题的原因及解决
- Java 高手之路笔记(1)
- 自定义圆形的ProgressBar
- Visual SVN-hook提交日志设置
- Jsp/servlet面试题
- 开源中国社区
- hibernate出现No row with the given identifier exists问题的产生原因及解决方法
- LCD ic的帧率计算
- 数据库查询优化方案(处理上百万级记录如何提高处理查询速度)
- 模板之型别选择
- 【LeetCode】Best Time to Buy and Sell Stock
- Android Volley 详解 Google发布的一套用于网络通信的工具库
- php实现兼容Unicode文字的字符串大小写转换strtolower()和strtoupper()
- android自定义弹出框样式实现
- 安装mod_python后,apache2无法默认显示index