Search code examples
javahibernateormsecond-level-cacheoracle-coherence

Is there a way to look into L2 hibernate cache?


I have a task to attach Oracle Coherence (it is cache software) in my project. One way of using it is Level2 Hibernate cache. I want to see when hibernate takes results from L2 cache. How can i do that? Both ways will be good: listener of some sort, if possible, or direct access to Cache object. Thanks in advance.


Solution

  • The Coherence Hibernate L2 integration allows you to specify a system property to point to the coherence cache configuration that will be used by the L2 cache. If you point the "normal" coherence cache configuration to the same file, this will allow you to access the caches via CacheFactory.getCache.

    -Dtangosol.coherence.cacheconfig=sample-cache-config.xml -Dtangosol.coherence.hibernate.cacheconfig=sample-cache-config.xml

    You can download an example here: http://coherence.oracle.com/download/attachments/16730/hibernate-sample-src.jar