-->
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: Can a discriminator do this?
PostPosted: Wed May 14, 2008 11:25 pm 
Newbie

Joined: Wed May 14, 2008 11:19 pm
Posts: 1
I'm a newbie to NHibernate and am wondering how to best handle the following scenario. Lets say I have a contact management application with company, contact, and address entities. A company and a contact can each have multiple addresses. I'd like to have the addresses defined in a single table with the following columns:

Id
ReferenceId
ReferenceType
Address1
Address2
City
State
Zip
etc.

The ReferenceId is a foreign key to either the Contacts table or the Companies table, depending on the value of the ReferenceType field. Could this be done using a discriminator?


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.