-->
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: Complex mapping with linking tables
PostPosted: Thu Sep 30, 2004 10:23 am 
Newbie

Joined: Thu Sep 30, 2004 10:00 am
Posts: 1
Hi.
I have a pretty complex problem and i'm not sure how to map it.

I have a standard tomcat User & UserRoles tables setup.
I also have what's going to be an event/class scheduler with the tables Event & EventInstructor

the schema looks like this:
Code:
----------       ----------------
|   User   |     |   User_Role    |
----------       ----------------
| ID (int) |     | ID (int)       |
| Name     |     | user_id (int)  |
| ...      |     | role (varchar) |
----------       ----------------


----------       ---------------------
|   Event  |     |  Event_Instructor   |
----------       ---------------------
| ID (int) |     | instructor_id (int) |
| Name     |     | event_id (int)      |
| ...      |      ---------------------
----------


Problem #1:
How do i map the Event & User using the Event_Instrucotr table?
I've looked at some posts about many-to-many, but my problem is that and event may or may not have an instructor, but if it does it can only have 1.

Problem #2:
An instructor is a User who has the role "instructor" in the User_Role table.
Not sure how to get only these Users to map to the Event_Instructor table.

Again, and event may or may not have up to 1 instructor, but and instructor can have many events.

Can anyone help me map this?

Thanks!

- Jonathan


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.