Multiple infinispan hibernate cache-containers in standalone.xml

Solution Verified - Updated -

Environment

  • Red Hat JBoss Enterprise Application Platform
    • 6.4.0

Issue

  • Currently we are migrating out JBoss 5.1-0-GA (hibernate, seam, ...) applications to JBoss EAP 6.4.With JBoss 5.1.0-GA we used ehcache as 2nd level cache for hibernate and are currently migrating to infinispan. Originally we had 4 slightly different ehcache-configurations which were configured in the various persistence.xml files e.g. by using:
<property name="net.sf.ehcache.configurationResourceName" value="ehcache_asd.xml"/>
  • Is there a way to use:

    • external infinispan configurations.
    • multiple hibernate cache-container sections
      in standalone.xml?
  • We already tried standalone.xml infinispan configurations like


<cache-container name="hibernate-asd" aliases="standard-asd-cache" default-cache="entity" module="org.jboss.as.jpa.hibernate:4"> ... <cache-container name="hibernate-abg" aliases="standard-asd-cache" default-cache="entity" module="org.jboss.as.jpa.hibernate:4"> ... <cache-container name="hibernate-asd-abg" aliases="standard-asd-cache" default-cache="entity" module="org.jboss.as.jpa.hibernate:4"> ... <cache-container name="hibernate-asd-sst" aliases="standard-asd-cache" default-cache="entity" module="org.jboss.as.jpa.hibernate:4">

Resolution

  • Hibernate Ehcache as a level 2 cache is not supported Does JBoss EAP 6 support Ehcache?
  • Need to use Infinispan as Hibernate second-level cache Configure Infinispan as a 2nd Level Cache in JPA/Hibernate
  • Adding additional caches for use by the JPA/Hibernate 2nd level cache is supported.
  • It's custom caches for direct use by the application that are not supported with Infinispan embedded in EAP.
  • By adding custom caches used directly by the application which is not supported.
  • If the application is putting/retrieving some operations directly in Infinispan, it's not supported. But hibernate using Infinispan underneath is supported.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.