I'm using Hibernate 4.1.1.Final with Spring MVC 3.1.x and using both first and second level cache. I configured my domain objects using annotations for cache operations. But cache doesn't store anything on the disk.
Here's my ehcache.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd">
<!--
<diskStore path="java.io.tmpdir"/>
-->
<diskStore path="java.io.tmpdir/ehcache"/>
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="120"
overflowToDisk="true"
maxElementsOnDisk="10000000"
diskPersistent="true"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/>
</ehcache>
Hibernate Cache Properties:
<prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop>
<prop key="hibernate.cache.provider_configuration_file_resource_path">ehcache.xml</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
Annonation-based configuration for domain objects:
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
No folder named **ehcache in the /tmp folder:**