Nhibernate出现No row with the given identifier exists问题的产生原因及解决方法
来源:互联网 发布:瑜伽约课软件 编辑:程序博客网 时间:2024/06/05 12:05
产生此问题的原因:
有两张表,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
- 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问题的原因及解决
- Hibernate中常见问题 No row with the given identifier exists问题的原因及解决
- 【牛客 题库】 求字符串长度和大小 || 基类和派生类的构造函数,隐式调用与显式调用 || 数组下标的数据类型
- XML语法规则
- Jquery实现图片轮播
- 我使用的沉浸式状态栏
- ValueError: cannot index a corpus with zero features (you must specify either `num_features` or a no
- Nhibernate出现No row with the given identifier exists问题的产生原因及解决方法
- 如何解决win10网络出现叹号,但是能连网问题
- C++和JNI的数据转换
- List泛型集合
- 支付宝小程序创建时的五大坑
- SpringBoot集成SpringSecurity+CAS
- mac python自带版本2.6与2.7 如何在Python Django 项目里使用新版Python3.x.x
- Java并发编程:线程池的使用
- random模块的使用