0 Replies Latest reply on Mar 17, 2013 11:31 AM by Somostetoi Kilato

    JBossCache 'Malagueta' 3.2.11.GA and persistence.xml

    Somostetoi Kilato Newbie

      Hi,

       

      Would anybody help me to configure my persistence-unit to use my cache?

       

      Here is the cache definition file:

       

      <?xml version="1.0" encoding="UTF-8"?>
      
      <deployment xmlns="urn:jboss:bean-deployer:2.0">
      
          <bean name="MyCacheConfig" class="org.jboss.cache.config.Configuration">
              <property name="runtimeConfig">
                  <bean class="org.jboss.cache.config.RuntimeConfig">
                      <property name="transactionManager">
                          <inject bean="jboss:service=TransactionManager" property="TransactionManager"/>
                      </property>
                  </bean>
              </property>
              <property name="lockParentForChildInsertRemove">false</property>
              <property name="lockAcquisitionTimeout">15000</property>
              <property name="isolationLevel">REPEATABLE_READ</property>
              <property name="concurrencyLevel">500</property>
              <property name="useLockStriping">true</property>
              <property name="writeSkewCheck">false</property>
              <property name="exposeManagementStatistics">true</property>
          </bean>
      
          <bean name="MyCacheFactory" class="org.jboss.cache.DefaultCacheFactory">
              <constructor factoryClass="org.jboss.cache.DefaultCacheFactory" factoryMethod="getInstance" />
          </bean>
      
          <bean name="MyCache" class="org.jboss.cache.Cache">
              <constructor factoryMethod="createCache">
                  <factory bean="MyCacheFactory"/>
                  <parameter class="org.jboss.cache.config.Configuration">
                      <inject bean="MyCacheConfig"/>
                  </parameter>
                  <parameter class="boolean">false</parameter>
              </constructor>
          </bean>
      
          <bean name="MyCacheJmxWrapper" class="org.jboss.cache.jmx.CacheJmxWrapper">
              <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.cache:service=MyCache", exposedInterface=org.jboss.cache.jmx.CacheJmxWrapperMBean.class, registerDirectly=true)</annotation>
              <constructor>
                  <parameter>
                      <inject bean="MyCache"/>
                  </parameter>
              </constructor>
          </bean>
      
      </deployment>
      

       

      and this is the persistence.xml

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      <persistence version="2.0"
          xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
      
          <persistence-unit name="sarsi_jpa">
              <jta-data-source>java:/SarsiDS</jta-data-source>
              <properties>
                  <property name="hibernate.hbm2ddl.auto" value="validate"/>
                  <property name="hibernate.show_sql" value="false"/>
                  <property name="hibernate.format_sql" value="true"/>
                  <property name="hibernate.order_updates" value="true"/>
                  
                  <property name="hibernate.connection.release_mode" value="after_statement"/>
      
                  <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
                  
                  <property name="hibernate.cache.use_second_level_cache" value="true" />
                  <property name="hibernate.cache.use_query_cache" value="true" />
                  <property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.jbc2.MultiplexedJBossCacheRegionFactory" />
                   
                  <property name="hibernate.session_factory_name" value="persistence.unit.sarsi"/>
                  
              </properties>
          </persistence-unit>
      </persistence>
      

       

      If I click on printCacheDetails I get only these

       

      --- Cache1 ---

      /  null

       

      ------------