Related Documentation : Integrations : Using Ehcache with Hibernate : Configuring Ehcache as the Second-Level Cache Provider
Configuring Ehcache as the Second-Level Cache Provider
To configure Ehcache as a Hibernate second-level cache, set the region factory property to one of the following in the Hibernate configuration. The Hibernate configuration is specified either via hibernate.cfg.xml, hibernate.properties or Spring. The format shown below is for hibernate.cfg.xml.
Hibernate 3.3 and higher
For instance creation, use:
<property name="hibernate.cache.region.factory_class">
net.sf.ehcache.hibernate.EhCacheRegionFactory</property>
To force Hibernate to use a singleton of Ehcache CacheManager, use:
<property name="hibernate.cache.region.factory_class">
net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory</property>
Hibernate 4.x
For instance creation, use:
<property name="hibernate.cache.region.factory_class">
org.hibernate.cache.ehcache.EhCacheRegionFactory</property>
To force Hibernate to use a singleton of Ehcache CacheManager, use:
<property name="hibernate.cache.region.factory_class">
org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory</property>
Copyright © 2014 Software AG, Darmstadt, Germany.

Product Logo |   Feedback