I don't have much experience with Hibernate second level cache providers. I have achieved, following EHCache documentation, to configure in my hibernate.cfg.xml and ehcache.xml files the EHCache cache provider. I don't get any Hibernate errors, but I want to really see if the Cache works.
I have downloaded EHCache monitor (free development version) and have followed the documentation (set the probe in the application and run the script) but I always get in the monitor 0 probes registered and no cache statistics are displayed.
I have following cache parameters in my hibernate.cfg.xml:
Code:
<property name="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.use_query_cache">true</property>
<property name="hibernate.generate_statistics">true</property>
my ehcache.xml file:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<ehcache>
<cache name="com.myproject.domain.client"
maxEntriesLocalHeap="50"
eternal="false"
timeToLiveSeconds="600"
overflowToDisk="true"
/>
<cache
name="com.myproject.domain.product"
maxEntriesLocalHeap="450"
eternal="false"
timeToLiveSeconds="600"
overflowToDisk="true"
/>
</ehcache>
In my hibernate xml entity mapping file I have added:
Code:
<cache usage="read-write" />
I have searched for this problem in the web and in different forums, I have tried different configurations but I didn't have any results, I always get no probe registered. I am using Hibernate 4.
By the way, I would like to know if there is any other free Hibernate second cache level solution that has a good monitoring system. Which second level cache solution is easier to integrate?
Thank you for your help and advice.