Why does Hibernate attempt to load “not-found=ignore” associations?

安稳与你 提交于 2019-12-12 12:35:41

问题


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.

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?


回答1:


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



来源:https://stackoverflow.com/questions/13085038/why-does-hibernate-attempt-to-load-not-found-ignore-associations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!