3 Replies Latest reply on Oct 1, 2014 9:28 AM by Radoslav Husar

    Using a different infinispan cachemanager/container (other than hibernate) for 2LC

    Rahul Daga Newbie

      Hey starksm64 or anyone else who cares,

       

      It seems that if one wishes to use a different container than the 'hibernate' one it still ends up using the hibernate container.  (AS 7.2.0.Final-redhat-8)

       

      For example if we create a new container called 'jpa' as below and verify the cache container started up fine via logs/admin console.

       

                 <cache-container name="jpa" default-cache="local-query" start="EAGER" module="org.jboss.as.jpa.hibernate:4" jndi-name="java:jboss/infinispan/jpa">
                      <local-cache name="entity">
                          <transaction mode="NON_XA"/>
                          <eviction strategy="LRU" max-entries="10000"/>
                          <expiration lifespan="1800000"/>
                      </local-cache>
                      <local-cache name="local-query">
                          <transaction mode="NONE"/>
                          <eviction strategy="LRU" max-entries="10000"/>
                          <expiration max-idle="1000000"/>
                      </local-cache>
                      <local-cache name="timestamps">
                          <transaction mode="NONE"/>
                          <eviction strategy="NONE"/>
                      </local-cache>
                  </cache-container>
      

       

       

      and add the cachemanager reference in persistence.xml for 2LC

       

           <property name="hibernate.cache.infinispan.cachemanager" value="java:jboss/infinispan/jpa" />
           <property name="hibernate.cache.region.factory_class" value="org.jboss.as.jpa.hibernate4.infinispan.InfinispanRegionFactory" />
      

       

      but it still uses the hibernate container.

       

      INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 59) JBAS010281: Started example.war#com.example.blah cache from hibernate container
      

       

       

      ordinarily this would be fine but I have need to use a different cache container for one of the apps and I cannot change the hibernate containers config. Appreciate any clues or alternate magic to achieve this..

       

      Message was edited by: Rahul Daga - Reason: I could not post the below earlier but thanks to Radoslav Husar I can!

        • 1. Re: Using a different infinispan cachemanager/container (other than hibernate) for 2LC
          Radoslav Husar Master

          Let me try to post the contents of the zip:

           

          It seems that if one wishes to use a different container than the 'hibernate' one it still ends up using the hibernate container.  (AS 7.2.0.Final-redhat-8)

           

           

          For example if we create a new container called 'jpa' as below and verify the container started up fine via logs and the admin console.

           

           

                      <cache-container name="jpa" default-cache="local-query" start="EAGER" module="org.jboss.as.jpa.hibernate:4" jndi-name="java:jboss/infinispan/jpa">

                          <local-cache name="entity">

                              <transaction mode="NON_XA"/>

                              <eviction strategy="LRU" max-entries="10000"/>

                              <expiration lifespan="1800000"/>

                          </local-cache>

                          <local-cache name="local-query">

                              <transaction mode="NONE"/>

                              <eviction strategy="LRU" max-entries="10000"/>

                              <expiration max-idle="1000000"/>

                          </local-cache>

                          <local-cache name="timestamps">

                              <transaction mode="NONE"/>

                              <eviction strategy="NONE"/>

                          </local-cache>

                      </cache-container>

           

           

          and add the cachemanager reference in persistence.xml.

           

           

               <property name="hibernate.cache.infinispan.cachemanager" value="java:jboss/infinispan/jpa" />

               <property name="hibernate.cache.region.factory_class" value="org.jboss.as.jpa.hibernate4.infinispan.InfinispanRegionFactory" />

           

           

          but it still uses the hibernate container.

          application log

           

           

          INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 59) JBAS010281: Started example.war#com.example.blah cache from hibernate container

           

           

          ordinarily this would be fine but I have need to use a different container for one of the apps and I cannot change the hibernate containers config. Appreciate any clues or alternate  magic to achieve this..

          • 2. Re: Using a different infinispan cachemanager/container (other than hibernate) for 2LC
            Radoslav Husar Master

            BTW I had to delete the word "woodoo" in order to be able to post your message.