Java Mailing List Archive

http://www.gg3721.com/

Home » users.openjpa »

EhCache integration questions

Adam Borkowski

2010-03-11

Replies: Find Java Web Hosting

Author LoginPost Reply

As OpenJPA L2 cache itself doesn't support dividing persistent classes into
multiple data caches I'm trying to use ehcache together with openjpa. Two
questions regarding this:

1) Is it possible to set data cache disabled by default for all classes and
then enable only few chosen by annotating them with
@DataCache(enabled=true), or something similar?

2) I noticed that ehcache creates separate data cache for each persistent
class. Is there a way to group persistent classes in a less granular way?

Let's say that I have classes Cat and Dog and want them to use common
ehcache configuration "animals".
Until now I can't make it happen. I tried below configuration:

@Entity
@DataCache(name="animals")
public class Cat

@Entity
@DataCache(name="animals")
public class Dog

excerpt from ehcache.xml:
  <cache name="animals"
      maxElementsInMemory="5"
      eternal="false"
      overflowToDisk="false"
      timeToIdleSeconds="300"
      timeToLiveSeconds="600"
      memoryStoreEvictionPolicy="LFU"
       />

excerpt from persistence.xml

      <property name="openjpa.DataCache" value="ehcache"/>

I'm using:
- ehcache-core-1.7.2
- ehcache-openjpa-0.2.0
- openjpa-1.2.2

regards,
Adam Borkowski

--
Sent from the OpenJPA Users mailing list archive at Nabble.com.
©2008 gg3721.com - Jax Systems, LLC, U.S.A.