[hibernate-dev] Second-level cache and Inheritance

Vlad Mihalcea mihalcea.vlad at gmail.com
Mon Jul 18 06:10:36 EDT 2016


Hi,

I bumped into this question on our forum:

https://forum.hibernate.org/viewtopic.php?f=1&t=1043470

And after I tried an example using the latest Hibernate version I see that,
for inheritance, all subentities share the parent region name.
This can  be found in org.hibernate.internal.CacheImpl

final String cacheRegionName = cacheRegionPrefix +
model.getRootClass().getCacheRegionName();


As you can see, we take the rootClass when constructing the region name.
For this reason, we cannot use different CacheConcurrencyStartegy with
different subclass types.

Is there any reason for this, or should we consider adding support for this
feature?

Vlad


More information about the hibernate-dev mailing list