views:

716

answers:

1

From my sql log file, I think the QueryCache's physical properties are configured by the element:

  <defaultCache
                maxElementsInMemory="0"
                eternal="false"
                timeToIdleSeconds="120"
                timeToLiveSeconds="120"
                overflowToDisk="false"
                memoryStoreEvictionPolicy="LRU"
                />

and even I add another element the element below to the ehcache.xml, is seems, from the sql log, that the QueryCache's physical properties are still configured by the element.

  <cache name="org.hibernate.cache.QueryCache"
                maxElementsInMemory="10000"
                eternal="false"
                timeToIdleSeconds="120"
                timeToLiveSeconds="120"
                overflowToDisk="false"
                memoryStoreEvictionPolicy="LRU"
        />

I just want to enable the QueryCache in memory, and meanwhile disable the others (in memory) by default. Maybe the name attribute of element is not correct? I copy it from the book <>. Or, should I use another element other than ? Maybe there is a kinda of element?

Thanks.

+4  A: 

Try: name="org.hibernate.cache.StandardQueryCache"

OMax
Thank you OMax! It's working! And I put <cache name="org.hibernate.cache.UpdateTimestampsCache" ...> into the ehcache.xml too.
keweishang
Make sure that you don't set up the UpdateTimestampsCache to expire elements, or at least not to expire them faster than your query cache. This will cause query results to be invalidated unnecessarily.
Alex Miller