JBoss Community

Re: WebApps sharing JPA entities in one cache

created by Ernie See in JBoss AS 7 Development - View the full discussion

Hi Scott, here is my Hibernate configuration:

 

<persistence-unit name="lms"
transaction-type="JTA">
<jta-data-source>java:jboss/datasources/lms</jta-data-source>
<shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
<properties>
<property name="hibernate.cache.use_second_level_cache" value="true" />
<property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.CMTTransactionFactory"/>
<property name="hibernate.cache.infinispan.statistics" value="true"/>
<property name="hibernate.cache.region.factory_class" value="org.jboss.as.jpa.hibernate4.infinispan.InfinispanRegionFactory"/>
<property name="hibernate.cache.region_prefix" value="lms"/>
</properties>
<class>pojo.Artikelstamm</class> ...

I have 2 web applications which both have a persistence unit containing the configuration listed above + addtional application specific classes.

After starting JBoss caching for Property instances works but each application caches it on its own.

If I have a look in JMX-Console (attached) I see that each application got two entries called "Infinispan 2" and "Infinispan 3" for application 1 and "Infinispan 4" and "Infinispan 5" for application 2.

This looks a bit strange?!?

If I fetch Artikelstamm entries in application 1 I get such entries listed in the JMX statistics part of Artikelstamm. But application 2 gets nothing of those entries to its cache.

Reply to this message by going to Community

Start a new discussion in JBoss AS 7 Development at Community