org.hibernate.cache.infinispan.InfinispanRegionFactory should default the "immutable-entity" to the "entity" cache settings

Description

Instead of WildFly cloning the "entity" cache configuration for "immutable-entity", it would be better if Hibernate defaulted to use the "entity" cache settings.

We just need to change org.hibernate.cache.infinispan.InfinispanRegionFactory from:

To:

So that the immutableEntity defaults to the "entity" cache settings.

And remove DEF_IMMUTABLE_ENTITY_RESOURCE.

from irc conversation:

<pferraro> smarlow: question - what is the point of the immutable-entity cache configuration?
<pferraro> smarlow: the config looks to be the same as for the entity cache configuration
<smarlow> yup, weird huh?
<smarlow> the problem is that its sort of immutable
<pferraro> smarlow: are immutable entities stored in a separate region?
<smarlow> Hibernate application code is not allowed to update the entity but can remove it
<pferraro> where remove = evict?
<smarlow> pferraro: @Immutable entities are stored in a separate cache. I mean "remove" as in delete from the database
<pferraro> smarlow: I see, but why do we need a separate cache configuration? why can't we reuse the entity cache configuration? like we do for the collection region?
<pferraro> smarlow: it would still get its own cache - but it would be configured the same as for mutable entities
<smarlow> that sounds good, is that a code change or config file?
<smarlow> the Hibernate equivalent is at https://github.com/hibernate/hibernate-orm/blob/master/hibernate-infinispan/src/main/resources/org/hibernate/cache/infinispan/builder/infinispan-configs.xml#L30
<pferraro> it would be logic to be handled via the infinispan region factory
<pferraro> so - with the collection region - the InfinispanRegionFactory creates a cache based on a configuration called "entity", unless overridden
<pferraro> I don't understand why we wouldn't do the same for immutable entities
<pferraro> I'm thinking this should be changed here: https://github.com/hibernate/hibernate-orm/blob/master/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/InfinispanRegionFactory.java#L520
<pferraro> lines 527-529, dictate the cache configuration used for collections if there is no "collection" cache config defined
<pferraro> So, line 525 should do the same for immutable entities
<pferraro> meaning, it should read: immutableEntityOverrides.setCacheName( DEF_ENTITY_RESOURCE );
<pferraro> that way, we don't need to define an superfluous "immutable-entity" cache configuration anywhere, since it is just a copy of the entity configuration

Activity

Show:

Scott Marlow January 5, 2016 at 10:18 PM

instead refer to

Scott Marlow January 5, 2016 at 10:17 PM

Please review https://hibernate.atlassian.net/browse/HHH-10416 instead, thanks.

Scott Marlow January 5, 2016 at 8:52 PM

Should we make this change for 5.0.7?

Rejected

Details

Assignee

Reporter

Components

Fix versions

Priority

Created January 5, 2016 at 8:47 PM
Updated January 5, 2016 at 10:18 PM
Resolved January 5, 2016 at 10:18 PM