Hi,
I am using JPA with Hibernate 3.5 Implementation. (But JPA 1.2 because of Myeclipse 8.6 IDE supports)
I am deploying on Tomcat container.
I have configured ehcache to cache the entity. But the entity are not getting cached.
Below is my configurations
In Persistence.xml
Quote:
<shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
<properties>
....
<property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.SingletonEhCacheRegionProvider"/>
<property name="net.sf.ehcache.configurationResourceName" value="/ehcache.xml"/>
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.region.factory_class" value="net.sf.ehcache.hibernate.EhCacheRegionFactory"/>
...
</properties>
On entity class,
In tried both
Quote:
@Cacheable(value=true) and @Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
In ehcache.xml,
Quote:
<cache name="dev.entity.Country"
maxElementsInMemory="2000"
eternal="false"
timeToLiveSeconds="43200"
timeToIdleSeconds="7200"
overflowToDisk="false"
/>
Note: At the time of tomcat started, it is creating the empty cache files on temp folder.
If anything wrong in above configurations, please correct me to proceed.
Thanks in advance