3 Replies Latest reply on Mar 2, 2008 4:34 PM by brian.stansberry

    JBossCache, POJO Cache, Hibernate, field replication - how d

    mzganiacz

      I have two simple questions.

      Is POJO Cache capable of replicating only changed fields?

      If so, is JBossCache as 2nd-level-hibernate-cache capable of doing the same?

      If not, is it because it just haven't been implemented, or is it impossible because of a form in which Hibernate puts data in the 2nd-level-caches (in "dehydrated" form)?

        • 1. Re: JBossCache, POJO Cache, Hibernate, field replication - h
          brian.stansberry

          That's 3 questions. :-) Answered in order:

          1) Yes, that's PojoCache's primary benefit.

          2) No, it isn't.

          3) A bit of both. Hibernate stores an entity in the 2nd level cache as an Object[], one element per field. To deal with such a representation, PojoCache would need to be able to handle detecting changes in elements in an array, which it currently cannot do. Jason is working to resolve that (perhaps in PojoCache 2.2). But even if that were solved the Hibernate folks would have to ensure that the same Object[] instance is consistently used throughout the Hibernate code (i.e. no creating a new Object[] with the same elements). I don't know how difficult that would be, but I imagine it would be very fragile.

          In most cases you're better off using JBC invalidation for entity caching anyway, which in terms of intra-cluster message traffic is lighter than any replication-based strategy, including PojoCache.

          • 2. Re: JBossCache, POJO Cache, Hibernate, field replication - h
            mzganiacz

            ok, thx.

            i'm just writing my master's degree dissertation on different caching mechanisms in Java... and JBC looks like it's going to be a winner :)

            • 3. Re: JBossCache, POJO Cache, Hibernate, field replication - h
              brian.stansberry

              Excellent. Be sure and let us know how things progress.