I have the following Hibernate persisted objects. Note: PersistentObject takes care of common persisting chores (uid, discriminator, version, timestamps)...
class Language extends PersistentObject {
HashMap entries_; // one-to-many hash map of entry key and entry instance o
}
class LanguageEntry extends PersistentObject {
String key;
String translation;
Language owner; // many-to-one
}
I have other classes that reference a Language.
class Group extends PersistentObject {
...
Language defaultLanguage_;
...
}
class User extends PersistentObject {
...
Language language_;
...
}
The issue is with each web request a new Language and LanguageEntries are loaded. This is causing scaling issues due to the 1000-10000 entries for a language. I would like to make Language and LanguageEntry be shared between sessions since it is read-only anyway (well for the purposes of this discussion it is).
Is this possible in Hibernate?
I know I can do it by not having Language and LanguageEntry be loaded in the same session as Group and User. I.e. have a global session that loads Language and :anguageEntries once. Then in the session for Group and User load the Language using a LanguageType that uses the Global session to load the Language and Entries if they aren't loaded already.
I would like to avoid this since there is a substantial framework in place around Hibernate that unfortuntealy would not Support separate sessions and configs that this would require.
Any help is appreciated...
regards,
Fizzy
|