-->
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: Mapping many-to-one with join.
PostPosted: Wed Oct 27, 2010 5:57 am 
Newbie

Joined: Wed Oct 27, 2010 5:19 am
Posts: 1
Hello there,
I'm experiment with NHibernate which so far has been a pleasant experience. However, today I hit a wall.
Easiest way to explain problem is by using an example, so thats what I will do.

I have a domain object called 'Machine' which has some properties like this.

Machine
Name
Weight
Height
Length
LocalizedName
LocalizedDescription
CultureCode

As you can see some of the properties are static like height, weight etc and will most likely never change. Then there are the properties which are language dependent like the name and description.
Because of this the data model looks a little different and is split into two tables that looks like this.

Machine
[PK]Name
Weight
Height
Length

LocalizedMachine
[FK]Name
LocalizedName
LocalizedDescription
CultureCode

Even though this is a one-to-many relationship (one machine is called many different things dependent on the language) I'm only interested in working with one language at a given time. Therefore I'm not interested in a collection of LocalizedMachine objects but just the two strings in the selected language. If I want to change language I just want to change the CultureCode property. Is it possible to make such a mapping with NHibernate ?

Thanks in advance
- Christian James


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.