You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Adam Borkowski <bo...@gmail.com> on 2010/03/11 12:14:34 UTC

EhCache integration questions

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

-- 
View this message in context: http://n2.nabble.com/EhCache-integration-questions-tp4715365p4715365.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: EhCache integration questions

Posted by Pinaki Poddar <pp...@apache.org>.
> As OpenJPA L2 cache itself doesn't support dividing persistent classes into
multiple data caches 

  OpenJPA 2.0 supports such feature, not only at class level you can
distribute at instance-level as well.
The feature is available in our nightly builds
Please refer
  
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_cache_distribution

-----
Pinaki 
-- 
View this message in context: http://n2.nabble.com/EhCache-integration-questions-tp4715365p4754574.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.