2011-07-21 4 views
3

繰り返してクエリと呼ばれるキャッシュにInfinispanを使用したいと考えています。JPA/Hibernateの第2レベルキャッシュプロバイダとしてInfinispanを使用しようとすると、成功しません。

Using Infinispan as JPA-Hibernate Second Level Cache Provider

私はこのためにHibernateを設定するには、このチュートリアルを追いました。

ログには、Infinispanが第2レベルのキャッシュとして使用され、クエリキャッシュが有効になっていることが示されていますが、クエリはキャッシュされていないようです。

私もこのチュートリアルを試しました: Infinispan as Hibernate 2nd-Level Cache in JBoss AS 5.x、成功もありません。

は、ここで私がやったコンフィギュレーションの抜粋です:

(orm.xml)

<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"> 

    <named-query name="retrievePolicySet"> 
     <query>from PSTRepresentationType p where p.realm=? AND p.policySetType.policySetId=?</query> 
     <hint name="org.hibernate.cacheable" value="true" /> 
    </named-query> 

    <named-query name="retrievePolicySetList"> 
     <query>from PSTRepresentationType p where p.realm=?</query> 
     <hint name="org.hibernate.cacheable" value="true" /> 
    </named-query> 
</entity-mappings> 

(persistence.xmlの)

<properties> 
    <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" /> 
    <property name="hibernate.show_sql" value="true" /> 
    <property name="hibernate.format_sql" value="true" /> 

    <property name="hibernate.cache.use_second_level_cache" value="true" /> 
    <!-- Enables the query cache. Individual queries still have to be set cachable. --> 
    <property name="hibernate.cache.use_query_cache" value="true" /> 
    <property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.infinispan.InfinispanRegionFactory" /> 

    <property name="hibernate.cache.infinispan.statistics" value="true" /> 
</properties> 

私は、JBoss EAP 5.1を使用していますハイバネーション・インフィニオン3.5.6-ファイナル。

+2

クエリをキャッシュ可能と宣言する方法を試しましたか?すなわち、query.setCacheable(true) クエリキャッシュが機能していないことをどのように知っていますか?あなたは具体的に何をチェックしていますか? –

答えて