Hi All,
I am using Hibernate 3.1.3 with EhCache 1.2. When I am using the second level Caching, in the Caching XML file I specified the location where to create the Caching files.
At run time, it is creating the Caching files. But it is not writing the Element to the cache.
When I get's the SessionFactory Statistics, it is showing "No Puts where made to the Second Level Cache".
The code snippets are given below.
Caching entries in the Hibernate Configuration file are:
Code:
<property name="cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</property>
<property name="provider_configuration_file_resource_path">/ehcache.xml</property>
<property name="use_second_level_cache">true</property>
<property name="use_minimal_puts">true</property>
<property name="use_query_cache">true</property>
<property name="use_structured_entries">true</property>
The ehCache XML file isCode:
<ehcache>
<diskStore path="\...\Cache"/>
<defaultCache
maxElementsInMemory="10000"
eternal="true"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true"
diskPersistent="true"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/>
<cache name="events.Event"
maxElementsInMemory="10"
eternal="true"
overflowToDisk="true"
timeToIdleSeconds="300"
timeToLiveSeconds="600"
memoryStoreEvictionPolicy="FIFO">
<cacheEventListenerFactory class="events.MyCacheEventListenerFactory" properties="name=Event"/>
</cache>
</ehcache>
I made entry for ehCache in the Mapping file as:
Code:
<cache usage="nonstrict-read-write" />
When Iam persisting an Object, the Object is getting persisted. But it is not adding to the second level cache.
The logging information after persisting the Object is,Code:
22 Jun 2006 15:37:50 -- INFO -- Statistics Commit...Statistics[start time=1150970869703,sessions opened=1,sessions closed=1,transactions=1,successful transactions=1,optimistic lock failures=0,flushes=1,connections obtained=1,statements prepared=2,statements closed=2,second level cache puts=0, second level cache hits=0,second level cache misses=0,entities loaded=0,entities updated=0,entities inserted=1,entities deleted=0,entities fetched=0,collections loaded=0,collections updated=0,collections removed=0,collections recreated=0,collections fetched=0,queries executed to database=0,query cache puts=0,query cache hits=0,query cache misses=0,max query time=0]
Can anyone help me, where I am doing the mistake?