[hibernate-dev] Cache region names are not prefixed in 5.3

Sanne Grinovero sanne at hibernate.org
Thu May 17 06:11:15 EDT 2018


I think this is the RegionFactory's responsibility, as Hibernate ORM
alone can't know if this is necessary.

Prefixing is one of many options to isolate caches; a Cache technology
might wish to use a different approach by implementing a custom
`org.hibernate.cache.spi.CacheKeysFactory`.

Not least the server / deployer might be able to hint the Cache
provider to tell if isolation is at all necessary.

In conclusion, by having Hibernate ORM not messing with prefixes
allows other technologies to implement more efficient solutions. Our
own code also ends up being more efficient by not needing to add a
prefix during each and every access to the cache.

Thanks,
Sanne

On 17 May 2018 at 06:34, Gail Badner <gbadner at redhat.com> wrote:
> I see that cache region names are not being prefixed in 5.3.
>
> EnabledCaching sets the TimestampsRegion region name
> to TimestampsRegion.class.getName(), and sets the QueryResultsRegion region
> name to QueryResultsRegion.class.getName(). [1]
>
> Without a prefix, WildFly is failing intermittently when there are 2
> persistence units with the query cache enabled due to:
>
> org.infinispan.commons.CacheConfigurationException: ISPN000453: Attempt to
> define configuration for cache org.hibernate.cache.spi.TimestampsRegion
> which already exists
>
> Entity region names are not being prefixed either.
>
> Should they be prefixed by Hibernate or by the RegionFactory?
>
> Regards,
> Gail
>
> [1]
> https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/cache/internal/EnabledCaching.java#L80-L92
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev


More information about the hibernate-dev mailing list