Upgrading From Ehcache versions prior to 2.0


This page contains notes for users upgrading from older versions Ehcache prior to 2.0.

Support for Hibernate 3.3 SPI

Beginning with Ehcache 2.0 there is support for the Hibernate 3.3 SPI implementation. This is important because Hibernate 3.3 has an updated caching SPI. Although still present in 3.3, the Hibernate 3.2 caching SPI has been deprecated.

Support for Hibernate 3.5 SPI

The SPI further changes in Hibernate 3.5. The Ehcache 2.0 implementation is forward-compatible with Hibernate 3.5.

Backward Compatibility

The EhCacheProvider class, which implements the 3.2 API is provided for backward compatibility. Anyone already using Ehcache with Hibernate will be using this version. We encourage you to upgrade to the new class, net.sf.ehcache.hibernate.EhCacheRegionFactory in preparation for when Hibernate drops support for the old SPI. In recognition of this, we have marked net.sf.ehcache.hibernate.EhCacheProvider as deprecated. The new cache region factory takes advantage of the new SPI to provide higher performance. The old SPI had heavy synchronization to ensure all of the different caching providers were thread-safe. The new SPI leaves that to the implementer. Ehcache does not require extra synchronization, so this overhead is avoided.

Unification with Terracotta’s Hibernate 3.2 Provider

In September 2009 Terracotta released its Hibernate Caching Provider which was set as follows:

         <property name="hibernate.cache.provider_class">


It features high performance clustered Hibernate caching using the Terracotta Server Array. The new 3.3 EhCacheRegionFactory replaces that provider and the old Ehcache provider - it is a superset of both and also implements the new SPI. The Hibernate provider required a Java agent. That is not required in the new provider. We recommend existing Terracotta Hibernate users upgrade to the Ehcache 2.0 provider.