Hibernate为什么尝试加载& quot; not-found = ignore& quot;.协会? [英] Why does Hibernate attempt to load "not-found=ignore" associations?

查看:48
本文介绍了Hibernate为什么尝试加载& quot; not-found = ignore& quot;.协会?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类(代表一个项目),该类通过多对一关系映射了另一个类(代表一个用户).随着用户的来往,我已确保将未找到属性设置为对关系的忽略.

I've got a class (representing a project) which maps another class (representing a user) through a many-to-one relationship. As users come and go I've made sure to set the not-found property to ignore on the relationship.

但是,似乎Hibernate仍然尝试通过对每个项目执行一个额外的SQL查询来加载丢失"的用户,在每个项目中,未找到属性应该将关系设置为.也就是说,在关联用户不再存在的情况下,我将使用not-found属性来简单地消除"该关系.但是,Hibernate试图一一读取这些关系.

However, it appears that Hibernate still attempts to load the "missing" users by executing one extra SQL query for each of the projects where the not-found property should have set the relationship to null. That is, in cases where the associated user no long exist, I would except the not-found property to simple "nullify" that relationship. However, Hibernate attempts to fetch these relationships one by one.

知道我可能做错了什么吗?

Any idea what I might do wrong?

推荐答案

您已禁用延迟加载并将fetchmnode设置为联接,因为Hibernate必须获取它们来决定是否应将其无效,并且不能仅通过一个ID

have you disabled lazy loading and set fetchmnode to joins because Hibernate has to fetch them to decide if it should nullify it or not and it can not decide that only with an id

这篇关于Hibernate为什么尝试加载& quot; not-found = ignore& quot;.协会?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆