[infinispan-issues] [JBoss JIRA] (ISPN-5854) NonTxInvalidationInterceptor added twice to cache used for Hibernate 2LC

Karl von Randow (JIRA) issues at jboss.org
Thu Nov 12 22:39:00 EST 2015


    [ https://issues.jboss.org/browse/ISPN-5854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13128587#comment-13128587 ] 

Karl von Randow commented on ISPN-5854:
---------------------------------------

Thank you, I have created it: https://hibernate.atlassian.net/browse/HHH-10286

I've done some more investigation and submitted a pull-request on the basis of that; hopefully / possibly correct!

Coming back to your original comment; I have been using the same cache for multiple entities, for years. This worked perfectly < Hibernate 5.0 when using the transactional concurrency strategy. Now using the read-write concurrency strategy it appears that {{SimpleCacheKeysFactory}} in Hibernate just uses the id as the cache key, preventing multiple entities from using a single cache. I haven't found any documentation of this change... is there something you can point me to?

But basically, it appears that I should be specifying a separate cache region for each of my Hibernate entity classes?

> NonTxInvalidationInterceptor added twice to cache used for Hibernate 2LC
> ------------------------------------------------------------------------
>
>                 Key: ISPN-5854
>                 URL: https://issues.jboss.org/browse/ISPN-5854
>             Project: Infinispan
>          Issue Type: Bug
>          Components: Integration 
>    Affects Versions: 7.2.5.Final
>            Reporter: Karl von Randow
>            Assignee: Galder Zamarreño
>
> I use the same Infinispan cache for multiple Hibernate entities. The {{PutFromLoadValidator}} looks for and replaces the {{InvalidationInterceptor}} the first time it sees the cache, but the second time it fails to find the {{InvalidationInterceptor}} and ends up with {{invalidationPosition = 0}} from line 168, which means it incorrectly removes the first interceptor from the chain and then tries to add the {{NonTxInvalidationInterceptor}} again, causing the exception below.
> Perhaps the {{NonTxInvalidationInterceptor}} should only be added once per cache, or the {{accessStrategy}} should be cached or something?
> {noformat}
> org.infinispan.commons.CacheConfigurationException: Detected interceptor of type [org.hibernate.cache.infinispan.access.NonTxInvalidationInterceptor] being added to the interceptor chain 170588969 more than once!
> 	at org.infinispan.interceptors.InterceptorChain.assertNotAdded(InterceptorChain.java:76)
> 	at org.infinispan.interceptors.InterceptorChain.addInterceptor(InterceptorChain.java:90)
> 	at org.infinispan.cache.impl.CacheImpl.addInterceptor(CacheImpl.java:883)
> 	at org.hibernate.cache.infinispan.access.PutFromLoadValidator.<init>(PutFromLoadValidator.java:192)
> 	at org.hibernate.cache.infinispan.access.PutFromLoadValidator.<init>(PutFromLoadValidator.java:133)
> 	at org.hibernate.cache.infinispan.impl.BaseTransactionalDataRegion.prepareForValidation(BaseTransactionalDataRegion.java:137)
> 	at org.hibernate.cache.infinispan.impl.BaseTransactionalDataRegion.createAccessDelegate(BaseTransactionalDataRegion.java:122)
> 	at org.hibernate.cache.infinispan.collection.CollectionRegionImpl.buildAccessStrategy(CollectionRegionImpl.java:49)
> 	at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:400)
> 	at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444)
> 	at org.hibernate.boot.internal.MetadataImpl.buildSessionFactory(MetadataImpl.java:170)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)



More information about the infinispan-issues mailing list