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: Inheritance mapping question
PostPosted: Mon Jun 09, 2008 6:27 pm 
Newbie

Joined: Mon Jun 09, 2008 5:54 pm
Posts: 1
I cannot figure this one out.

I have an Employees table in SQL Server

EmployeeId
LastName
FirstName
SubsidiaryId (maps to Subsidiary table and class)
IsAdministrativeManager
IsProjectManager

Where IsAdministrativeManager and IsProjectManager are bit fields.
There are four possbilities. An employee can be a plain employee. Can be an AdministrativeManager. Can be a Project Manager. Or can be both an administrative manager and a project manager

I want to have an Employee class and two subclasses: Administrative Manager class and Project Manager class.

Adminstrative Manager has AssignedEmployees that is supported by a administrators_employees table as a many to many association table. A employee can have multiple administrativce managers.

AdministratorId
EmployeeId

Both AdministratorId and EmployeeId are foriegn key relationships back to the EmployeeId of the Employees table.

Project Manger Class is has AssignedProjects, supported by a projects_employees many to many assoication table.

ProjectId
EmployeeId

ProjectId is a foriegn key relationship back to a projects table which is maps to a projects class.

I've explored the docs on inheritance mapping, blogs, this forum, my NHibernate in Action book and cannot figure out how to map this structure.

Table per class hierarchy doesn't seem to work since I have two discrimators. And that the employees table have no fields for the sub-classes.

Table per subclass doesn't seem to work due to the many-to-many relationship in the administrative_employees mapping

Any enlightenment on an approach to mapping these classes and tables will be appreciated?



Thanks,

ERDoll


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.