-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How to use same cache name for different entity classes,
PostPosted: Wed Feb 08, 2012 6:20 am 
Newbie

Joined: Tue Jan 10, 2012 8:40 am
Posts: 5
Hi All,
i am using hibernate with ehcache, i have the 50 entity classes, how should I use the same cache element(Inside ehcache.xml)
for multiple Entity classes,
or is it mandatory to declare different 50 cache elements respective to 50 entity classes ???

please, reply as soon as possible,
Thanks,
Vinit Shah.


Top
 Profile  
 
 Post subject: Re: How to use same cache name for different entity classes,
PostPosted: Thu Feb 09, 2012 6:06 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Hi vinit,

you just have to declare regions where to put the entities:

example:

Code:
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region="Eternal")
public class FirstEntityClazz {
...
}

@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region="Eternal")
public class YourSecondEntityClazz {
...
}


Each "region" must correspond to a cache-element in ehcache.xml:

Code:
...
<cache  name="Eternal"
            maxElementsInMemory="40000"
            eternal="true"
            overflowToDisk="false"
            memoryStoreEvictionPolicy="LRU">
  </cache>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.