need to see hibernate cache contents configured using coherence

Discussions

General J2EE: need to see hibernate cache contents configured using coherence

  1. How do I see contents of hibernate second level
    cache configured using coherence. I tried using both weblogic & tomcat
      1. I did add to hibernate configuration
    "hibernate.cache.provider_class=net.sf.hibernate.cache.CoherenceCacheProvider"
      2. after compiling CoherenceCacheProvider.java and
    CoherenceCache.java
    (http://www.hibernate.org/132.html) and put in
    classpath.
       Application worked fine without any errors in
    weblogic 8.1. (note: application doesn't work when the CoherenceCacheProvider/CoherenceCache files or coherence.jar/tangosol.jar are not in classpath-- that means it is using these files)

       But still no "keys" get populated after I ran-
    "com.tangosol.examples.explore.SimpleCacheExplorer" in another window. I am using default configuration that came with coherence.
       
    I need to show people here how the cache contents are
    being populated.

    Anyone done this before?
    If so please explain setup.
  2. Hi Hari,

    I would suggest using the Coherence command line application to view the data stored in the L2 caches. To start the command line application, set up your classpath and then use the following command: 'java com.tangosol.net.CacheFactory'. Then, you will have to "bring focus" to the specific cache you want to look at with the following command 'cache <region_name>' (Hibernate creates the caches using the internal region name). Then you can do any number of operations including 'list', 'size', 'get <key>', etc.

    I would also suggest taking a look at this FAQ item. It covers the details on how to configure the CoherenceCacheProvider to use different caching topologies. By default (using the default coherence-cache-config.xml; located at the root of coherence.jar) the CoherenceCacheProvider uses a replicated cache. If you are going to be storing a large amount of data in the L2 cache you may be interested in using the partitioned cache (i.e. 'distributed-scheme').

    Later,
    Rob Misek
    Tangosol, Inc.
    Coherence: It just works.
  3. it worked[ Go to top ]

    Thanks Rob,
       The info was useful to see various regions that hibernate created. ( regions were also created based on the FQN of POJOs ).
    I put one SOP in CoherenceCacheProvider constructor to get the region names, and switched using "cache <region name>".

    Hari.