Hi there !
I have a strange probleme using a query cache with ehcache.
I have declared a cache region in ehcache.xml which I want to use:
<cache name="queryCache.ItemDAO.getAllSimpleItems"
eternal="false"
overflowToDisk="false"
timeToIdleSeconds="300"
timeToLiveSeconds="600"
/>
And declared (using annotations) a query to be cached :
@NamedQuery(name="query.ItemDAO.getAllSimpleItems",
query="from SimpleItem",
hints = {@QueryHint(name = "org.hibernate.cacheable", value = "true"),
@QueryHint(name = "org.hibernate.cacheRegion", value = "queryCache.ItemDAO.getAllSimpleItems"),
@QueryHint(name = "org.hibernate.timeout", value = "100"),
@QueryHint(name = "org.hibernate.fetchSize", value = "1"),
@QueryHint(name = "org.hibernate.flushMode", value = "Commit"),
@QueryHint(name = "org.hibernate.cacheMode", value = "NORMAL"),
@QueryHint(name = "org.hibernate.comment", value = "Return all items.") } )
With this configuration, query result is never cached ( I activated debug log and controlled the trace).
IF I change the QueryHint "org.hibernate.cacheRegion" to name another cache region, ie "testRegion", then the cache works !
Obviously, if I use a cache region name declared in ehcache, things won't work...
Did I missed something ?
Thanks for your help,
sne.
|