hibernate项目里面配了很多many-to-one的关联,后台在查询数据时已经作了健全性判断,但还是经常抛出对象找不到异常:
org.hibernate.ObjectNotFoundException: No row with the given identifier exists:
在有外键的实体类中找到关联的对象,在get方法上加注解
@NotFound(action=NotFoundAction.IGNORE)
探讨Hibernate框架中many-to-one关联查询时出现ObjectNotFoundException的原因及解决策略,通过在get方法上使用@NotFound注解来避免异常。
hibernate项目里面配了很多many-to-one的关联,后台在查询数据时已经作了健全性判断,但还是经常抛出对象找不到异常:
org.hibernate.ObjectNotFoundException: No row with the given identifier exists:
在有外键的实体类中找到关联的对象,在get方法上加注解
@NotFound(action=NotFoundAction.IGNORE)
1054
8582
1万+
1757
1828

被折叠的 条评论
为什么被折叠?