[hibernate-dev] HHH-10418 and Infinispan

Steve Ebersole steve at hibernate.org
Thu Nov 16 21:28:25 EST 2017


No that is currently broken.  See
https://hibernate.atlassian.net/browse/HHH-11356

This won't be fixed in 5.x as fixing it required significant changes to the
caching SPIs to resolve.

On Thu, Nov 16, 2017 at 8:10 PM Gail Badner <gbadner at redhat.com> wrote:

> Steve/Radim,
>
> Is it OK if an entity and collection region have the same name, they will
> use the same AdvancedCache? I realize that the key will be different (as
> long as hibernate.cache.keys_factory != simple).
>
> I'm assuming they use the same access strategies, etc. I know there would
> be problems if they didn't (HHH-10707/HHH-11356).
>
> I've been looking at how things are implemented in 5.2 to avoid the
> ClassCacheException when an entity region and collection region has the
> same name.
>
> I see that org.hibernate.internal.CacheImpl has a separate map for each
> type of cache (i.e., entity, collection, natural-id). [1]
>
> I also see that org.hibernate.cache.infinispan.InfinispanRegionFactory#
> buildEntityRegion and #buildCollectionRegion both call #getCache. [2]
>
> #getCache checks to see if there is already a cache with the specified
> regionName, but does not take the type (i.e., entity, collection,
> natural-id) into account. If there is already a cache with that region
> name, it will be used.
>
> In other words, it seems that if an entity and collection region have the
> same name, they will use the same AdvancedCache.
>
> I just want to confirm that this is intended and there is no problem with
> having different types of data in the same AdvancedCache.
>
> Thanks,
> Gail
>
> [1]
> https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/internal/CacheImpl.java#L59-L61
> [2]
> https://github.com/hibernate/hibernate-orm/blob/master/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/InfinispanRegionFactory.java#L680-L729
>


More information about the hibernate-dev mailing list