-->
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.  [ 5 posts ] 
Author Message
 Post subject: How to add one element to collection without loading?
PostPosted: Wed Jun 27, 2007 11:58 am 
Regular
Regular

Joined: Wed May 02, 2007 2:42 pm
Posts: 101
Hey,

Lets say i have - Department
Department has a List of Emploee (@OneToMany).

I want to add one emploee to the list withot loading the whole collection.

department.getEmployee().add(emploee)
will load the collection and it is bad if i have a big collection.


Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 29, 2007 10:58 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
do employee.setdepartment(), you won't have to load the whole collection

_________________
Emmanuel


Top
 Profile  
 
 Post subject: So, i have to use bi-directional?
PostPosted: Fri Jun 29, 2007 11:13 am 
Regular
Regular

Joined: Wed May 02, 2007 2:42 pm
Posts: 101
I dont lova to have bi-directional , because its require to take care of the two directios.

Also lets say that i have
Department with List of Employee
And also BussinessUnit with List of Employee

You need to have two functions of addElementToCollection.

Also remove is more complicated.

is there any alternative way to add to the collection without load it?

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 29, 2007 11:28 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
no make it bidirectional
having a unidirectional onetomany should be very uncommon

_________________
Emmanuel


Top
 Profile  
 
 Post subject: Why onetomany is uncommon?
PostPosted: Sun Jul 01, 2007 4:01 pm 
Regular
Regular

Joined: Wed May 02, 2007 2:42 pm
Posts: 101
If it is list , so the getCollection.add not load the collection


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

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.