Hibernate:No row with the given identifier exists

问题描述:

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

问题原因:数据错误!

先说下两张表的关联关系:

表A

表B

列名
A1(PK)
A2(FK)=B1
A3
列名
B1(PK)
B2
B3

 

如果在TestB中新增一条数据,其中B2=9,而TestA表中不存在A1=9的数据,那么在使用Hibernate对象关联查询时,就会出现上面的错误!

解决方法:

删除TestB表中新增的数据或者在TestA表中增加对应的数据,即可。

posted @ 2013-01-25 16:04  玛索小铺  阅读(444)  评论(0编辑  收藏  举报