Somostetoi Kilato
2013-03-17 15:31:15 UTC
Somostetoi Kilato [https://community.jboss.org/people/somostetoikilato] created the discussion
"JBossCache 'Malagueta' 3.2.11.GA and persistence.xml"
To view the discussion, visit: https://community.jboss.org/message/803140#803140
--------------------------------------------------------------
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
Reply to this message by going to Community
[https://community.jboss.org/message/803140#803140]
Start a new discussion in JBoss Cache at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2052]
"JBossCache 'Malagueta' 3.2.11.GA and persistence.xml"
To view the discussion, visit: https://community.jboss.org/message/803140#803140
--------------------------------------------------------------
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
------------
--------------------------------------------------------------/Â null
------------
Reply to this message by going to Community
[https://community.jboss.org/message/803140#803140]
Start a new discussion in JBoss Cache at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2052]