-->
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.  [ 3 posts ] 
Author Message
 Post subject: Collections and Associations
PostPosted: Sat Nov 25, 2006 12:12 am 
Newbie

Joined: Sat Nov 25, 2006 12:02 am
Posts: 4
Please excuse my ignore ...

I am having some problems differentiating the difference between the 2. Can somebody give me a clear explanations?

If I want to map a master detail table relationship like order and order_details, what kind of mapping do i use? is it collection mapping? Then are what example use of association mapping?

Thanks
james


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 25, 2006 6:16 am 
Newbie

Joined: Tue Sep 19, 2006 4:13 am
Posts: 18
James..
Perhaps this is not the right forum to start with. :)
Just go through the hibernate docs - it has some exhaustive notes around Mappings and associations.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 8:50 am 
Senior
Senior

Joined: Mon Oct 23, 2006 5:12 am
Posts: 141
Location: Galicia, Spain
Collection is a collection (surprise!) of elements: a set, a map, a bag etc.

Association is a association between entities (one-to-one, one-to-many, many-to-one, etc)

So

Order has an collection called "details", which should be accesed using something like:

Order order;
order.getDetails() ; //Set, for example

At the same time, there is an Association between Order and OrderDetails:

<class name="Order">
<set name="details"> <--------- this is the Collection
<key column="id_order">
<one-to-many class="OrderDetail"/> <-------- this is the association
</set>

_________________
andresgr (--don't forget to rate)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.