[jboss-jira] [JBoss JIRA] (WFLY-5963) Custom caches not injected into cache container

Scott Marlow (JIRA) issues at jboss.org
Fri Jan 8 10:23:00 EST 2016


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

Scott Marlow commented on WFLY-5963:
------------------------------------

Thank you for the jira Radim.  Also thanks for the following code suggestion from our IRC conversation.  I understand it might not work as is but I like the idea expressed by the following. :-)

{code}
@Override
public void addCacheDependencies(Classification classification, Properties properties) {
	for (Map.Entry<String, String> property: properties.entrySet()) {
		String key = property.getKey();
		if (key.startsWith(InfinispanRegionFactory.PREFIX) && key.endsWith(InfinispanRegionFactory.CONFIG_SUFFIX)) {
			if (!key.equals(InfinispanRegionFactory.INFINISPAN_CONFIG_RESOURCE_PROP)) {
				 addDependency(CacheServiceName.CONFIGURATION.getServiceName(container, property.getValue()));
			}
		}
	}
}
{code}


> Custom caches not injected into cache container
> -----------------------------------------------
>
>                 Key: WFLY-5963
>                 URL: https://issues.jboss.org/browse/WFLY-5963
>             Project: WildFly
>          Issue Type: Bug
>          Components: JPA / Hibernate
>    Affects Versions: 10.0.0.CR5
>            Reporter: Radim Vansa
>            Assignee: Scott Marlow
>
> Hibernate ORM using Infinispan Second Level Cache allows to let certain entities use different cache configuration, using property {{hibernate.cache.infinispan._com.example.Entity_.cfg=_anotherCache_}}
> However, as the dependency to cache _anotherCache_ is not defined in {{InfinispanCacheDeploymentListener.addCacheDependencies}} (this method lists only the default caches), the cache configuration is not set in the cache manger. ORM then retrieves the configuration for cache _anotherCache_, but as it was not inserted to the cache manager, the cache manager will return default cache configuration (which can be e.g. local when a clustered cache is required). No warning or notification that the configuration was not copied from WF's standalone.xml to cache manager is emitted.



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


More information about the jboss-jira mailing list