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