3 Replies Latest reply: Oct 16, 2012 6:50 PM by 965779 RSS

    Managing versioning of objects within the Coherence Cache

    965779
      What are best practices of using different versions of an object within the Coherence Cache.
      Say, I have a Person object with only one attribute: String firstName. I add this object to the NamedCache.
      Later, I add a new attribute to the Person object: String lastName such that there are now two attributes in the class (firstName and lastName). I suspect an exception will be thrown when I try to add the newer version of the Person object to the NamedCache with the same key.
      What are best practices of managing versioning of objects within the Coherence Cache?

      Edited by: 962776 on Oct 16, 2012 7:14 AM
        • 1. Re: Managing versioning of objects within the Coherence Cache
          user738616
          Hi,

          Coherence supports the versioning of the objects using Evolable interface and details can be found here: http://docs.oracle.com/cd/E24290_01/coh.371/e22843/com/tangosol/io/Evolvable.html

          HTH

          Cheers,
          _NJ                                                                                                                                                                                                                                                                                                                                                                                                                                               
          • 2. Re: Managing versioning of objects within the Coherence Cache
            robvarga
            user738616 wrote:
            Hi,

            Coherence supports the versioning of the objects using Evolable interface and details can be found here: http://docs.oracle.com/cd/E24290_01/coh.371/e22843/com/tangosol/io/Evolvable.html

            HTH

            Cheers,
            _NJ
            To elaborate on this a bit further: Coherence versioning of classes if POF is used for serialization, and you should probably read the corresponding chapter from the Coherence 3.5 book, too. And adding on that, Coherence 3.6 upwards supports nested POF streams which allow you to overcome the restrictions on subclassing and class evolution by opening a nested PofWriter/PofReader for the superclass data so that each declared class can have its full set of POF property ids starting with 0 (or 1, as 0 would be used for the nested POF stream property id).

            Best regards,

            Robert