-->
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.  [ 2 posts ] 
Author Message
 Post subject: Localization strategy guidance needed
PostPosted: Tue Mar 01, 2005 2:47 pm 
Newbie

Joined: Tue Mar 01, 2005 2:13 pm
Posts: 1
I read regarding mapping multiple tables to a single class that it is usally an effect of poor database design. That article reffered to the following page http://www.hibernate.org/Documentation/Delegate
where it says: "We consider it an essential element of good object model design that the object model be at least as granular as the relational model"

Where does that leave us when it comes to localizing our persistent data? How do guys you solve that problem? The soultion I'm using ( see below ) does not fit Hibernate as I see it. I do want to map two tables to a single class.

Let's say that I have a table called Region containing information about a geographical region. To localize that table I have extracted the name and description to a another table called RegionLang. But I would like the user of the objectmodel to be unaware of the fact that the data resides in two tables.

That is:

Table - Region
----------------------
Fields:
RegionID
Latitude
Longitude


Table - RegionLang
----------------------
Fields:
RegionID
LanguageCode
Name
Description

Class - Region
----------------------
ReportID
Latitude
Longitude
Name
Description


How do I solve this in Hibernate? Preferably without having to write QL. Is there any other smarter way to localize database data?

Oh, BTW. I have to use this without stored precedures, views etc. Just plain SQL in the end.

Sincerely, RD


Top
 Profile  
 
 Post subject: Re: Localization strategy guidance needed
PostPosted: Tue Mar 01, 2005 4:28 pm 
Regular
Regular

Joined: Thu Dec 18, 2003 2:14 am
Posts: 103
Location: Brooklyn, NY
Use composition.
Pick the RegionLang out of the database based on locale, and delegate all non-localized field calls to the associated (shared) Region object. It thus appears to be a unified object to the user code.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.