c******n 发帖数: 4965 | 1 I enabled ehcache as second level cache,
from TRACE level logging, I can see that hibernate/ehcache did try to place
query result/load result into cache, but every time I query with the same
parameter (i.e. there is only one uniq query), so it says
"caching xxx ..."
"xxx is already cached",
this is fine.
but it seems that after trying to read from the cache for only 1 time, it
never tries to use the cache again.
I can see on the first read, it logs:
2011-12-20 15:29:53,344 95419 INFO [org.hibernate.cache.StandardQueryCache]
[http-8080-2][] starting query cache at region: org.hi
bernate.cache.StandardQueryCache
2011-12-20 15:29:53,348 95423 DEBUG [org.hibernate.cache.StandardQueryCache]
[http-8080-2][] checking cached query results in regio
n: org.hibernate.cache.StandardQueryCache
but this never appears again.
so why is it not using the cache?
I did set the properties in hibernate.cfg.xml, and used setCacheable() and
setRegion() in my session.createQuery().list()
thanks |
|