These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate Shared References
PostPosted: Wed Feb 10, 2010 2:26 am 
Newbie

Joined: Wed Feb 10, 2010 2:10 am
Posts: 1
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.