-->
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 an "extension table(s)"
PostPosted: Fri Jul 11, 2008 7:27 pm 
Newbie

Joined: Fri Nov 16, 2007 6:20 pm
Posts: 15
I have a situation where I need to create a relationship between two entities. The relationship will be one to one, but one of the entities exists in a database I don't have the ability to modify, so I created an "extension table" to represent the relationship:

Organization
OrgId
Name

Style
StyleId
StyleInfo

StylesForOrgs
StyleId
OrgId

The tables are more complex than that, but you get the idea. I want to map the the table to my Organization entity and cohesively as possible so the domain layer doesn't know or care about the extension table. Every Organization has a Style object in it.

How would I go about this? I thought of using a many-to-many, but I didn't want to use set semantics on the Organization entity since each Org will only have a SINGLE style. Additionally, the organization table might change and I might get my field in there.

Would a View be a better approach? Map the combined Organization + Style in my domain?

Is there a way to do this WITHOUT a view with nHibernate and not use a set or bag?

Worst case I use the bag and write some domain logic to handle this case.


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.