Reputation: 81
I am trying to configure infinispan for caching in hibernate. Please can someone provide me with the steps that i need to follow and the configurations that i need to add in the infinispan-cache.xml file
Upvotes: 2
Views: 1658
Reputation: 154130
First of all you need to add the following Hibernate properties:
<property name="hibernate.cache.use_second_level_cache" value="true" />
<property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.infinispan.JndiInfinispanRegionFactory" />
<property name="hibernate.cache.infinispan.cachemanager" value="java:CacheManager" />
Then you need to set the Entity cache selection policy:
<property name="javax.persistence.sharedCache.mode" value="ENABLE_SELECTIVE"/>
Only the entities annotated with @javax.persistence.Cacheable
would be stored in the second-level cache.
Upvotes: 1