[jboss-user] [JBoss Seam] - Second level cache (ehcache) working?

shakenbrain do-not-reply at jboss.com
Wed May 16 13:24:44 EDT 2007

Has anyone been able to get ehcache working in a Seam application?  I've enabled ehcache in my persistence unit:

         <property name="hibernate.cache.use_second_level_cache" value="true"/>
  |          <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/>

and enabled caching for one of my entities:

@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
  | public class Organization extends PersistentObject {
  | ...
  | }

I created a basic ehcache.xml file as follows:

  |     <diskStore path="java.io.tmpdir"/>
  |     <defaultCache
  |         maxElementsInMemory="10000"
  |         eternal="false"
  |         timeToIdleSeconds="120"
  |         timeToLiveSeconds="120"
  |         overflowToDisk="true"
  |         diskPersistent="false"
  |         diskExpiryThreadIntervalSeconds="120"
  |         memoryStoreEvictionPolicy="LRU"
  |         />
  | </ehcache>

I put ehcache.xml into a jar file called ehcache.jar in server/default/lib so ehcache is able to find it.  Where is this file really supposed to go?  Does it really have to live there because that's where ehcache-1.2.3.jar is?

After loading an entity in my Seam application I update it in underlying database using an external application.  I would expect the entity to remain unchanged when viewing in it my Seam application because the object should be cached, but it's obviously being reloaded from the database.

Any ideas?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4046235#4046235

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4046235

More information about the jboss-user mailing list