-->
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: Is @OneToMany unidirectional is a good design?
PostPosted: Tue Jul 03, 2007 2:16 am 
Regular
Regular

Joined: Wed May 02, 2007 2:42 pm
Posts: 101
A few days ago in another forum somone told me that @OneToMany unidirectional is not a good design.

As i see it from the point of view of java developer and not from the DB side this is more compatible with Java, because in the class diagram you will see that class A has list<B>.

In the DB there are a FK or association table , but in java this one to many represented as a Collection.

i know that for performance @OneToMany unidirectional is not good, because you need to load the collection in order to add one element :
a.getListOfB().add(b)

So what do you think:
1. is it a bad mapping?
2. what is preffered OneToMany with association table or with FK?
The default for unidirectional is association , but when i change to bidirectional it dosnt use association.


Thank you


Top
 Profile  
 
 Post subject: Additional question on the same issue
PostPosted: Tue Jul 03, 2007 1:48 pm 
Regular
Regular

Joined: Wed May 02, 2007 2:42 pm
Posts: 101
What is a "good" time for loading collection of 100 objects?

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 04, 2007 1:47 am 
Regular
Regular

Joined: Mon Apr 02, 2007 3:54 am
Posts: 67
Location: Hyderabad
As Per me This is good for one-to-many associations with an indexed collection (list, map or array) as the "many" end. allows bi-directional association.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 04, 2007 1:47 am 
Regular
Regular

Joined: Mon Apr 02, 2007 3:54 am
Posts: 67
Location: Hyderabad
As Per me This is good for one-to-many associations with an indexed collection (list, map or array) as the "many" end. allows bi-directional association.

Thanks,
Gopal
[please rate, if helpful]


Top
 Profile  
 
 Post subject: Can you explain?
PostPosted: Wed Jul 04, 2007 2:31 pm 
Regular
Regular

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


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.