-->
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: Recommended way to map a Relation with attributes
PostPosted: Thu Jan 17, 2008 10:35 am 
Newbie

Joined: Thu Jan 17, 2008 8:19 am
Posts: 1
Hi,

I've been looking for the best way to model a relation between two entities
carrying attributes and did note really thing anything clear (to me at least).

For instance, given a User entities and a Newspaper, what would be my
options to model a subscription ? Basically the subscription is a relation that
carry a start_date and an end_date attribute.

So I see so far two way to do it :

* mapping three classes with one-to-many : User, Subscription and
Newspaper.

* Employee - Employment - Organization mapping style as explain at the
end of the chapter 7.6 of the Hibernate3 Reference manual. (althought that
exemple is not very clear to me. Is it bi-dirretional ?)

I think that M-N relations carrying attributes are not that uncommon. Maybe
it could be explained better in the manual. Or I am missing something ?


Top
 Profile  
 
 Post subject: Re: Recommended way to map a Relation with attributes
PostPosted: Thu Jan 17, 2008 1:08 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
You might be able to do it with the Employee - Employment - Organization style but the first option is more rational. Map the association as a class itself.


Farzad-


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.