-->
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: Design-Question: Relation One-To-Two
PostPosted: Mon Oct 11, 2010 1:43 pm 
Newbie

Joined: Mon Oct 11, 2010 1:31 pm
Posts: 2
Hey there

I'm new to NHibernate (or mappers in general), so bear with me :)
The design is quite simple: Given two tables Announcement adn AnnouncementText. AnnouncementText contains the language-depending rows. If the system has two languages, for each entry in Announcement you would find two entries in AnnouncementText. Quite simple so far.

The Domain-Model would then contain two classes, mapping the two tables. In the class Announcement I would store an IList for AnnouncementText, and maybe a helper-getter where I could receive the wished language. I would let the class Announcement construct the two (if two languages) AnnouncementText-instances in the constructor, making sure the date is well shaped when a new entry is created.

Mapping with NHibernate shouldn't be a problem, simple many-to-one relation as far as I understood. My only concern is the following: since NHibernate also will use Announcement's constructor, two AnnouncementText will be constructed. Will NHibernate overwrite these two instances in the IList when loading the two entries from the DB?
Or would you recommend some other design?

Any tips much appreciated!

Regards
sl3dg3


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.