Hi All, What is the state of play on using JCS as a Hibernate distributed second-level cache? Is it possible to configure this?
I note on the Hibernate website that there is some out-of-date documentation on configuring JCS as a cache provider in Hibernate 2. Since then it seems JCS has fallen out of favour with Hibernate developers. I don't see why. There does not seem to be an alternative cache provider for Hibernate, which provides distributed cache functionality like JCS does. Apart from Coherence, which seems extremely expensive. There are several distinct subsystems within this company - inbound/outbound message interfaces (A), message processing systems (B), web servers (C). We have common code which is shared between all systems - user account objects, lookup data objects etc. Each subsystem also has its own subsystem-specific set of objects however. We want a distributed cache to allow subsystem C to access user account and lookup data objects added to the cache by subsystem A. We do not want subsystem C to receive replicated cache data for objects only needed by subsystem A however. Thus we can't just configure every subsystem on our network to be in the same cluster, as it would flood our network with pointless traffic. We need to segment our data so data stored in some cache regions is propagated or accessible only to specific subsystems, but data stored in other cache regions is accessible to all systems company-wide. JCS supports this sort of configuration and it's why we are using it. The apparent downside to JCS however, is that it's not documented as capable of being configured as a Hibernate 3.2 second level cache, and we load most of our data from databases using Hibernate. To store Hibernate objects in the JCS cache, we are having to avoid defining the relationships between our Hibernate persistent classes (i.e. specify the relationships between the DB tables they represent) so that at runtime when we try to put a persistent object in the JCS cache, it does not 'pull' the referenced objects with it. If JCS was supported as a Hibernate second-level cache directly, Hibernate would take care of this "object reference problem" automatically, as it does for the other caches it supports directly. Basically, we need the power of JCS as a distributed cache, because none of Hibernate's other caches are powerful enough, but it would simplify things for us a great deal if we could just configure Hibernate to use JCS as a second-level cache. Has anyone tried this? We are using Hibernate 3.2 with Hibernate-annotations for accessing the DBs. We have written some "JCS annotations" which we use to configure JCS regions on-the-fly using a JCS wrapper interface we have written. This allows us to specify the type of JCS caching we want per-class using annotations (e.g. lateral/clustered vs. company-wide distributed). Any information on JCS + Hibernate would be appreciated. Kind regards, Niall ____________________________________ Niall Gallagher Senior Developer / Architect Switchfire Ltd. phone: + 44 (0)20 7798 2807 fax: + 44 (0)20 7798 2801 email: [EMAIL PROTECTED] web: www.switchfire.com