Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
 
yeah, but ... what would PIE do? Especially concerning this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic