-->
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.  [ 2 posts ] 
Author Message
 Post subject: Unidirectional associations
PostPosted: Wed May 10, 2006 1:32 pm 
Regular
Regular

Joined: Sun Feb 12, 2006 10:18 pm
Posts: 60
Location: Rosario, Argentina
Are Unidirectional associations considered a bad practice? are they thinked only for parent - child relations where the child cannot live with the parent (this last question is because the example in the help reference uses "Person" and "Adress" clases, where the Address can't live without the Person).

I have a class called "Desriptions" that handles all simple "id - description" tables ("type of currencies", "types of documents", "types of customers", etc), so this class is pretty much in any other class, but an "description" object does not depend on another object to exist. If I map this class as a bidirectional association, then the class needs to have a "Set" variable for each of the other classes, and furthermore, for those classes that have more than one instance of this class, there are multiple Set variables. This variables are actually useless, since when I need an instance of "Descriptions", I certainly do not need any those variables... so I'm guessing a unidirectional association here, but I don't know for sure, and so far the bidirectional way is working (hopefully, working fine).

I'd appreciate any insigths to this matter, thanks!

Alejandro.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 11, 2006 5:32 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Unidirectional associations are not considered a bad practice, but bidirectional associations are required for inverse="true" collections.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.