aspose file tools*
The moose likes EhCache and the fly likes Cache Always Misses (using Hibernate + EhCache) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Caching » EhCache
Bookmark "Cache Always Misses (using Hibernate + EhCache)" Watch "Cache Always Misses (using Hibernate + EhCache)" New topic
Author

Cache Always Misses (using Hibernate + EhCache)

Syed M. Ali
Greenhorn

Joined: Nov 14, 2012
Posts: 1
I'm using Hibernate with Spring framework, and trying to cache a query which is written through the CriteriaAPI. I've enabled the query cache and the 2nd Level cache. I've also set the setCacheable to true in that particular query. The problem is that hibernate session statistics show that it hits the database everything for the same query I'm running multiple times.

Here's the function with the criteria query


here's the caller function


spring-hibernate-context file



ehcache portion of this class



Log Excerpts:

I'm fairly new to Spring and Hibernate. I've read at least a dozen articles regarding this issue and did everything that I could. Also, I wrote a similar query using createQuery method, the result was the same. Any help would be appreciated.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cache Always Misses (using Hibernate + EhCache)