[hibernate-dev] Question about Hibernate 4.0 Infinispan second level cache usage...

Scott Marlow smarlow at redhat.com
Tue Aug 16 10:06:20 EDT 2011


I'm looking at o.h.c.i.InfinispanRegionFactory and wondering how best to 
configure the 2lc for AS 7.1.  After a recent forum discussion and 
opening AS7-1544, I need to make some corrections to properly 
accommodate multiple JPA persistence units sharing the same underlying 
cache definition or having their own.

Currently, with AS 7.0/7.0.1, I think each application should have its 
own Infinispan cache definition.  In theory, the same cache definition 
could be shared if entity class names are unique across all persistence 
units (within apps and across different applications).  This can be 
accommodated currently by adding additional Infinispan configuration 
entries to the AS7 standalone.xml (or domain.xml).

One question that I have, is could we add an additional key for 
identifying the 2lc cache.  The additional key that I have at the time 
of creating the container managed entity manager, is the "application 
name scoped persistence unit name" (includes the PU name and the 
application/containing jar name).  Perhaps that could be passed into 
InfinispanRegionFactory via a property representing a unique way to 
refer to all 2lc entries for a specific applications persistence unit 
definition.  I'm not sure how desirable it would be to further qualify 
the cache entries with this additional information (especially if it 
increases the payload transferred during replication).

I think the alternative would be to have each application, configure 
their own cache definition (either to share with all applications PU or 
create a separate definition per PU).  This might be close to what I 
already described as a workaround in the 
http://community.jboss.org/message/620903 forum post.

What do you think?

Scott



More information about the hibernate-dev mailing list