Hello. In our company we have big hierarchy of classes. And we have many relations between classes/objects. For example we have BusinessObject, and relations with diff objects Relation. But we have many business objects classes, and if we make session.load(BusinessObject.class, uuid), then hibernate will make big sql query (20-30kb). Hibernate will join all descendant classes. But using one relation with different type property is good. We can't make many relations.
Also we have cache, that can tell me class by uuid.
We can use session.load(cache.getClass(uuid), uuid)
and sql will be small.
But when we use hql for retrieve objects, or objects loaded as many-to-one property, we can't use this triсk.
I try to use my LoadEventListener and override onLoad method, or change LodEvent to my load event, where i change class to my class from cache. But i think, this way will kill many hibernate mechanizms. (may be cache, batch loading or else).
May be anybody knows how i can do this class change to descendant class, to some uuids on objects load? Need do it without dirty tricks. Thanks.
|