I have an object graph like so...
Diet Meal 1 Food A Food B Meal 2 Food A Food C
When Business logic makes changes to Food A for Meal 1, Food A in Meal 2 is also changed, it is using a shared reference because Food is an entity. I want these to not be shared instances when I query for this object graph using hql.
"select distinct diet from Diet as diet " + "left outer join fetch diet.dietMeal as dietMeal " + "left outer join fetch dietMeal.meals as meals " + "left outer join fetch meals.mealfood as mealfood " + "left outer join fetch mealfood.foods as foods " +
I want them to all be new instances and have no shared references when I query for the graph. What can I do?
|