-->
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: Inserting into Join table
PostPosted: Wed Jun 30, 2010 6:56 pm 
Newbie

Joined: Wed Dec 02, 2009 8:50 pm
Posts: 5
Hi,

I have a many to many relationship between Items and Tags. So I created a join table Item_Tag. I don't have an intermediate association class.

To add a tag to item I am doing:

Code:
item.getTags().add(tag);


Let us assume that this item already has 5 tags and a 6th one is being added. When I save the item, Hibernate is issuing an update on item table, a update on each of the 5 existing tags and one insert for the new tag.

How do I tell Hibernate not to bother about updating the existing 5 tags. Just insert the new tag.

Thank you very much,


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.