Related Documentation : Integrations : Using Ehcache with Hibernate : About Using Ehcache with Hibernate
About Using Ehcache with Hibernate
Accelerating Hibernate applications typically involves reducing their reliance on the database when fetching data. Terracotta offers powerful in-memory solutions for maximizing the performance of Hibernate applications:
*Ehcache as a plug-in second-level cache for Hibernate – Automatically cache common queries in memory to substantially lower latency.
*BigMemory for an in-memory store – Leverage off-heap physical memory to keep more of the data set close to your application and out of reach of Java garbage collection.
*Automatic Resource Control for intelligent caching – Pin the hot set in memory for high-speed access and employ fine-grained sizing controls to avoid OutOfMemory errors.
Ehcache easily integrates with the Hibernate Object/Relational persistence and query service. Gavin King, the maintainer of Hibernate, is also a committer to the BigMemory Go's Ehcache project. This ensures Ehcache will remain a first-class data store for Hibernate.
Configuring Ehcache for Hibernate is simple. The basic steps are as follows:
*Download and install Ehcache in your project as described in Downloading and Installing Ehcache for Hibernate.
*Configure Ehcache as a cache provider in your project's Hibernate configuration as described in Configuring Ehcache as the Second-Level Cache Provider.
*Enable second-level caching in your project's Hibernate configuration as described in Enabling Second-Level Cache and Query Cache Settings.
*Configure Hibernate caching for each entity, collection, or query that you want to cache as described in Configuring Hibernate Entities to use Second-Level Caching.
*Configure the ehcache.xml file for each entity, collection, or query configured for caching as described in Configuring ehcache.xml Settings.
For additional information about cache configuration in Hibernate, see the Hibernate product documentation at http://www.hibernate.org/.
Important Notices - PLEASE READ
In order for Hibernate 4.x to work with Ehcache 2.7.5 or higher, a patch can be downloaded from the Hibernate website at https://hibernate.atlassian.net/browse/HHH-8732.
Users of Ehcache for Hibernate prior to Ehcache 2.0 should read Upgrading from Ehcache Versions Prior to 2.0. These instructions are for Hibernate 3.
Copyright © 2010-2015 Software AG, Darmstadt, Germany.

Product Logo |   Feedback