-->
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: How to do a Many to Many recursive mapping
PostPosted: Tue Apr 13, 2010 6:07 pm 
Newbie

Joined: Thu Mar 03, 2005 4:35 pm
Posts: 5
All,

The application is question is a "Learning Management System. I have a need to do a Many to Many recursive mapping. I have a table called Person. This stores all of the information relating to any of the different types of Person in the system. Persons can play the role of "user", "agent", "administrator" and a few others. This is no problem. The recursive issue comes in when I have "student". The student has all the same details as the "user", but a "student" has to be associated to a "user". I was thinking of creating a "Student" table that would hold the primary key for the parent ("user") and the primary key for the "student". Both of the keys would originate within the Person table.

Person => Student <= Person
personId - parentId
studentId - PersonId

I only have the Person.hbm.xml and I have not seen anything in the hibernate documentation that describes this situation. If you know where there is documentation or if you have solved this issue, I would be most grateful for any assistance.


Top
 Profile  
 
 Post subject: Re: How to do a Many to Many recursive mapping
PostPosted: Wed Apr 14, 2010 5:23 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Quote:
a "student" has to be associated to a "user".


As each student has to be associated to one "user" (and not to more than one),
this sounds more like being a ManyToOne relation than a ManyToMany.


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.