I have been looking all day for a solution to this problem. I have a solution / job.
@OneToMany(fetch = FetchType.LAZY,cascade = CascadeType.ALL, orphanRemoval=true ) @JoinColumn(name="PROJECT_ID", nullable=true) private Set<Person> personlist = new HashSet<Person>();
I have a similar problem with products and ingredients.
Food may exist without being an ingredient in the recipe. An ingredient cannot exist without food. Thus, we have one zero or many between the ingredient and the food:
RECIPE 1 ------------- 1 .. * INGREDIENT 0 .. * --------- 1 FOOD
Please excuse the description of the trash. I hope you understand.
When the sample type is below EAGER, I get the same problem as you. when he is lazy, I do not.
@NotFound(action = NotFoundAction.IGNORE) @OneToMany(mappedBy = "food",
This is not a good solution, just a job. I think that the choice of EAGER should appear without errors, even if you donβt get anything, then I will have affordable food, and if they are ingredients in recipes, then I have these ingredients available in my subject, and through this recipes, which they are. If they are not ingredients, but simply products on their own, I still want to receive products - itβs just that they will not have any ingredients that are not related to the problem ... but cannot have them if this is the only work around
Does anyone have a better solution? If you do, you can save my life here :-)