-->
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.  [ 1 post ] 
Author Message
 Post subject: how to map list of lists of lists with many-to-many assoc
PostPosted: Mon Oct 10, 2005 4:57 pm 
Newbie

Joined: Mon Oct 10, 2005 4:07 pm
Posts: 1
I am just getting started with Hibernate and I am trying to figure out how to map a relationship I have. I have a class called Section, a class called Question and a class called PossibleAnswer. Section has a list of questions and Question has a list of possible answers. Section and Question have a many-to-many relationship as do Question and PossibleAnswer. I have come up with a schema (and if this is really dumb, please let me know) where there will be a table called Section_Question which will have an id field, a sectionID field, a questionID field and a listPosition field. Additionally, there will be a table called Question_PossibleAnswer which will have an id field, a sectionQuestionID field, a possibleAnswerID field and a listPosition field. (In the actual application, there are five classes that have this relationship, not three).

What I don't understand is how to map these classes. Using the <list> tag, how would one create a primary key field as well as the foreign keys I need?

If someone could point me in the right direction that would be great.

Thanks for your help,
Rob


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.