Ehcache easily integrates with the OpenJPA persistence framework.
To use it, add a Maven dependency for ehcache-openjpa.
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-openjpa</artifactId>
<version>0.1</version>
or download from downloads.
Set OpenJPA�s openjpa.QueryCache to ehcache and openjpa.DataCacheManager to ehcache. That�s it!
See http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manual/ref_guide_caching.html for more on caching in OpenJPA.
As with Hibernate, Ehcache's OpenJPA module (from 0.2) uses the defaultCache configured in ehcache.xml to create caches.
For production, we recommend configuring a cache configuration in ehcache.xml for each cache, so that it may be correctly tuned.