Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to use Infinispan as a JPA/Hibernate second level cache provider, without success
    primarykey
    data
    text
    <p>I would like to use Infinispan to cache repeatedly called queries.</p> <p>I followed this tutorial to set up Hibernate for this:</p> <p><a href="https://docs.jboss.org/author/display/ISPN/Using+Infinispan+as+JPA-Hibernate+Second+Level+Cache+Provider" rel="nofollow">Using Infinispan as JPA-Hibernate Second Level Cache Provider</a>.</p> <p>I followed every step, and while the log shows that Infinispan is used as a second-level cache and query caching enabled, no queries seem to be cached.</p> <p>I also tried out this tutorial: <a href="https://docs.jboss.org/author/display/ISPN/Infinispan+as+Hibernate+2nd-Level+Cache+in+JBoss+AS+5.x" rel="nofollow">Infinispan as Hibernate 2nd-Level Cache in JBoss AS 5.x</a>, also without success.</p> <p>Here are excerpts of the configuration I've done:</p> <p>(orm.xml)</p> <pre><code>&lt;entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" version="1.0"&gt; &lt;named-query name="retrievePolicySet"&gt; &lt;query&gt;from PSTRepresentationType p where p.realm=? AND p.policySetType.policySetId=?&lt;/query&gt; &lt;hint name="org.hibernate.cacheable" value="true" /&gt; &lt;/named-query&gt; &lt;named-query name="retrievePolicySetList"&gt; &lt;query&gt;from PSTRepresentationType p where p.realm=?&lt;/query&gt; &lt;hint name="org.hibernate.cacheable" value="true" /&gt; &lt;/named-query&gt; &lt;/entity-mappings&gt; </code></pre> <p>(persistence.xml)</p> <pre><code>&lt;properties&gt; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" /&gt; &lt;property name="hibernate.show_sql" value="true" /&gt; &lt;property name="hibernate.format_sql" value="true" /&gt; &lt;property name="hibernate.cache.use_second_level_cache" value="true" /&gt; &lt;!-- Enables the query cache. Individual queries still have to be set cachable. --&gt; &lt;property name="hibernate.cache.use_query_cache" value="true" /&gt; &lt;property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.infinispan.InfinispanRegionFactory" /&gt; &lt;property name="hibernate.cache.infinispan.statistics" value="true" /&gt; &lt;/properties&gt; </code></pre> <p>I'm using JBoss EAP 5.1 and hibernate-infinispan 3.5.6-Final.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload