hibernate出现No row with the given identifier exists问题

Posted 输入密码

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了hibernate出现No row with the given identifier exists问题相关的知识,希望对你有一定的参考价值。

产生此问题的原因:

有两张表,table1和table2.产生此问题的原因就是table1里做了关联<one-to-one>或者<many-to-one>来关联table2.当hibernate查找的时候,table2里的数据没有与table1相匹配的,这样就会报No row with the given identifierexists这个错。

 

解决方法:

1.修改数据使关联字段能查询到数据

2.在<many-to-one>中设置not-found="ignore",此时如果关联关系不存在,对应的属性值为Null.

以上是关于hibernate出现No row with the given identifier exists问题的主要内容,如果未能解决你的问题,请参考以下文章

Hibernate Validator with Hibernate Dynamic Models (No Entity Class)

Hibernate报错:org.hibernate.ObjectNotFoundException: No row with the given identifier exists 解决办法(示例代码

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

No row with the given identifier exists

Flutter 使用 flutter_inappbrowser 加载 H5 及与 js 交互,Methods marked with @UiThread must be executed on th

《Beginning Hibernate-For Hibernate 5, 4th Edition》(01_导读介绍)