I Need to implement ehcache in my existing project, for which i am using ehcache
WROTE ehcache.xml file
ENABLED cahcing in hibernate
ADDED entries in log4j for testing
I have and existing query like
Now when i am running the above query in a loop for 10 times, it always hits the database and gets the result, the cache logs says "
item already cached" also the SecondLevelCacheStatistics show
0 hits.
Now when i added the
setCacheable(true) to the below query
The above worked and i got the expected result
My question is that as i am working on existing maintaince project, do i need to add
setCacheable(true) to every concerned query.
Does second level caache depends on query cache (
hibernate.cache.use_query_cache) ' value.
I there any other way out so that i need not to write
setCacheable(true) to every query?
Thanks