-->
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: manytomany collection performance
PostPosted: Thu Jan 08, 2009 6:14 am 
Newbie

Joined: Fri Mar 28, 2008 12:37 pm
Posts: 3
I am trying to optimize performance for adding data in a manytomany relationship. I was initially using a collection, but this results in a delete and reinsertion in the bridge table each time I add to the collection. I have converted to a list with an @CollectionId definition which is better as it avoids the delete/reinsert. However Hibernate is still fetching the entire collection whenever I add to the collection:

Code:
Parent p = (Parent) entityManager.find(Parent.class, id);
Child c = new Child();
c.setParent(p);
p.getChildren().add(c);
entityManager.flush();


Chapter 19.5 of the hibernate docs suggests that Hibernate should avoid the collection fetch when adding to a collection with inverse="true". Is there an equivalent in JPA? I am using Seam 2.1 and am happy to use Hibernate extensions.


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.