• 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 ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Himai Minh

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

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?



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.


You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic