File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EhCache and the fly likes EHCache not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Caching » EhCache
Bookmark "EHCache not working" Watch "EHCache not working" New topic

EHCache not working

Poornima Sharma
Ranch Hand

Joined: Sep 09, 2008
Posts: 114
Hi Friends,

I am unable to implement EHCache in my application. To do this I followed the following procedure:-

1. Added the following details in hibernate.cfg.xml:-

<property name="hibernate.cache.provider_class">net.sf.ehcache.hibernate.SingletonEhCacheProvider</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.provider_configuration_file_resource_path">/ehcache.xml</property>

2. created ehcache.xml with default properties and few class properties.

3. Added <cache usage="read-only"/> in hibernate properties file and the sets.

When I run my application I see that EHCache is assigned properly, however I cannot see the affects, the speed of the execution of application is same and when i check the cacheHitCount it is 0.

It seems like I am missing something. Can anybody guide me the right procedure? Is there any example showing the correct implementation or are there any junit test cases to test the working functionaltiy.

Please suggest.


Poornima Sharma
SCJP 6.0
Arun Kumarr
Ranch Hand

Joined: May 16, 2005
Posts: 661

Can you post your ehcache.xml and tell us which app server you are using?

If you are not laughing at yourself, then you just didn't get the joke.
Ganesh Shirsat
Ranch Hand

Joined: Jan 10, 2010
Posts: 33

Are you load a data in Object form or using HQL query.?

please check that hibernate fire the query for your data?

I agree. Here's the link:
subject: EHCache not working
It's not a secret anymore!