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: Using Bags for performance adding in Collections
PostPosted: Tue Jun 09, 2009 10:38 am 
Newbie

Joined: Thu Jun 19, 2008 4:49 am
Posts: 12
Hello,

I need a solution to insert an element to a Collection without loading the whole elements of that Collection before inserting.

With a ManyToMany relation between UserGroups and Roles given, i want to add a Role to a UserGroup like usergroup.getRoles().add(role). However, Hibernate initializes the Collection before adding the element (reason).

A solution ought to be using a Bag instead of a List/Set.

How do I accomplish that? Do I use a secret @Bag Annotation or should I use the org.hibernate.mapping.Bag class as the member-type of the Collection? I couldn't find any examples for that so I would be glad to see some (using annotations).


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.