原因
对应实体使用了注解 @ManyToOne 数据库中的记录可能由于某一条数据的对外引用时缺失数据,导致对应关系找不到而直接向上抛出异常
org.hibernate.ObjectNotFoundException: No row with the given identifier exists
解决方式
在对应加有注解@ManyToOne 的属性上同时加上 注解 @NotFound(action=NotFoundAction.IGNORE),默认动作是向上抛出异常,这里动作修改为不理会即可
@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
@NotFound(action=NotFoundAction.IGNORE)
private PropertyEnt propertyEnt;
1088




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



