-->
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: Association classes confusion with ternary associations
PostPosted: Thu Jan 20, 2005 8:05 pm 
Newbie

Joined: Thu Jan 20, 2005 7:10 pm
Posts: 1
This is a generic question for both Hibernate 2.x and 3.x versions.

Im a little new to hibernate and am trying to find out the posible ways i can map association classes to POJOs. Following is a detailed example and question.

Sorry for the long message, but im trying to give as much info as possible.

Relational Schema:
----------------------
1) Table called "Risk".
Columns; riskid int, riskname varchar(200).

2) Table called "Mission".
Columns; missionid int, missionname varchar(200).

3) Association between Mission and Risk; many-to-many, called "Mission2Risk"

4) Association class connected to association "Mission2Risk" called "Severity".
Columns: severitynumber int, severitynotes varchar(200)

Short description of diagram; A certain mission (could be anything like eg. learning how to ride a horse), has many risks (eg falling off) associated with it. The same risk can be in more than one mission. A mission risk relationship has severity associated with it. Meaning, for falling off a horse, the the same risk would be of severity "very high", but falling off a 3ft rock, the severity would be "low".

So, here are my questions:
--------------------------------
Q1. How do I map this in hibernate? I know i'll have a pojo called mission and risk. But what about mission2riskSeverity? Im not sure if it makes sense i have that as a pojo - rather it and all its attributes (severitynumber etc) should be instead attributes of ??

Q2. Is there more than one way to map this? If yes, what are the possible ways?

Q3. Now in UML, ternary associations and association classes are two separate things. Can association classes be mapped as a ternary association? What happens when you have a model with a ternary association along with an association class?

Q4. I saw a feature in Hibernate 3.x called: "ability to map association tables as having one-to-many multiplicity at the object level". What does this mean? Does it have anything to do with association classes? If yes, where can I find a concrete example of this feature?

Appreciate anyones help.

Thanks a mill,
Girish


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 20, 2005 8:42 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
http://www.hibernate.org/hib_docs/reference/en/html_single/#collections-ternary


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 20, 2005 8:45 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
As for question #4, they are unrelated. That features simply means that even though we an association table and thus a many-to-many relation in the database, Hibernate will allow us to map this in the Java model as though it were a many-to-one.


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.