Hello,
I would like to discuss the well-known internationalization problem with hibernate.
First, I would need a database schema
Code:
- Entity (ID:char32)
- Entity_Text (Entity_ID:char32, Locale_ID:char32, Description:varchar50)
- Locale (ID:char32)
With Entity_Text.Entity_ID refering to Entity.ID
and Entity_Text.Locale_ID refering to Locale.ID
Second, I would need a class model
Code:
- Entity with a public method getDescription() and a private HashMap of Entity_Text indexed by Locale
- Entity_Text with public methods getDescription() and getLocale()
- Locale
Behind Entity.getDescription(), we would have something like
Code:
this.HashMap.get(currentLocale).getDescription();
The main idea is to allow the following:
- we can manage the fact that the currentLocale is modified at run-time
- if no description exists for the current Locale, we can search for another description (see Locale search order - For example, if nothing was found with Locale "en_US", search with Locale "en")
Now my question: could you indicate me how should I proceed in order to load in the Hashmap of the Entity only the requested Locale(s) ? In fact, I would like to load only part of the collection. In other words, I would like to have a lazy loading on part of the collection.
If this is not (yet) possible, does someone know if it will possible with Hibernate 3.0 ? (with some filters ?)
Kind regards, Emmanuel