File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EhCache and the fly likes What is the proper configuration for OpenJPA using ehcache as a distributed second level cache? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Caching » EhCache
Bookmark "What is the proper configuration for OpenJPA using ehcache as a distributed second level cache?" Watch "What is the proper configuration for OpenJPA using ehcache as a distributed second level cache?" New topic
Author

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

Hunter Stern
Greenhorn

Joined: Sep 01, 2004
Posts: 2
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is the proper configuration for OpenJPA using ehcache as a distributed second level cache?