Hi.
I'd like to ask the experienced hibernate users for advice to choose a correct inheritance subclassing strategy.
I've read the online documentation as well as (very useful, btw) java persistence with hibernate book, and still stuck...
Here is the deal: I have a table hierarchy for multilingual support, that consists of one main table and multipple language tables for each logical type, i.e. cities is the main one and holds things like code, iscapital, etc. while cities_en, cities_ru and cities_fr are corresponding tables with localized information like city name. The same going for states, countries, etc...
From java point of view I'd like that each city will be a subclass of some AbstractCity class, according to locale (i.e. I'll have CityEn, CityFr and CityRu, all 3 are subclasses of AbstractCity). This is a requirement and has to be done this way, other kind of mapping is not an option.
Now, the most logical choice is to map cities table to some AbstractCity class and then each of CityFr, CityEn, etc. as a joined subclasses, with mapping to corresponded localized table. The problem is that it seems I can only do one-to-one relations this way, while I need that each row from cities general table will be part of each localized city, joined with corresponding localized information (the key is same, of course).
Please help me with this, I fill that I'm missing something simple that prevents me from getting it to work.
Thanks a lot,
Alex.
|