0 Replies Latest reply on Jun 29, 2005 1:01 PM by ssghuman

    Use TreeCacheListener with Hibernate

    ssghuman

      I'm using JBoss-Cache as the second level cache in Hibernate. The application is deployed across two nodes and the treecache.xml file has appropriate settings to enable asynchronous replication (REPL_ASYNC)

      The problem is that state is maintained in an application cache also, there is no way to change this (legacy code). When a cache update (or insert) is received by the JBoss-Cache through cache replication, I need to propagate the change to my application cache. I found that I could do this by registering for cache events using the TreeCacheListener interface, however I can't figure out how to register my implementation of the TreeCacheListener with TreeCache. AFAIK the only way to register a listener is by calling TreeCache.addListener() - since I'm using Tree-Cache behind hibernate I don't have a reference to the TreeCache object. Is there a way to specify the listener as a configuration variable - say thru the treecache.xml file.

      I'm cross-posting to the hibernate forum to find out if they have a solution...