• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What is the proper configuration for OpenJPA using ehcache as a distributed second level cache?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using OpenJPA with ehcache as a distributed second level cache. My application is based on Spring MVC. I have enabled distributed caching using the <terracotta/> element within the <cache> elements of my ehcache.xml. My problem is that I am seeing cache misses when I repeat the same query against the query cache. Also, I see cache misses when I retrieve objects. I believe my configuration is somehow not right. Can anyone post a workable configuration or verify the one I am using?

ehcache.xml



persistence.xml



Query Code




Java TagCloutItem class



A related issue is that when I query an object using EntityManager.find on one jvm, the full object graph (the Entity relations) don't seem to get cached although the primary object does. For example, on jvm1 I load a User object. The next HTTP request calls EntityManager.find on jvm2 and loads the related Entity data using the cached User object. However, on the next failover, the related Entity data gets loaded again (User.getRelatedObjects()), as though this data was not put in cache and distributed to jvm1's second level JPA cache.

Please let me know if any of this is not clear.

Thanks,

H
 
reply
    Bookmark Topic Watch Topic
  • New Topic