1 Reply Latest reply on Jul 28, 2011 5:00 PM by sannegrinovero

    Surviving refactorings

    jmfaerman

      How do you survive refactorings with infinispan?

       

      I just started learning, but if i understood correctly, objects are serialized in the cache.

      How do you handle de-serialization when the class has changed?

       

      Would it be a better idea to store only "value maps" for this reason? how do you handle that in your applications?

        • 1. Re: Surviving refactorings
          sannegrinovero

          Hi,

          yes that's something we have to live with.

          Hibernate OGM dehidradates the entities in their simple primitives, so it avoids the problem. So does the Hiberante 2nd level cache: it doesn't store the entities directly, which has the nice side effect of making them immutable and avoiding references to user application code.

           

          Generally objects are either primitives (like people storing String instances), or you create a custom Externalizer to control the binary format: it's then up to you to be able to maintain backwards compatibility for your own code: when you change a class, you can choose how to deal with the old object format, possibly updating it on the fly to a default value, or dropping the value. Also, nothing prevents you to encode your data in flexible object formats like JSON.

          https://docs.jboss.org/author/display/ISPN/Plugging+Infinispan+With+User+Defined+Externalizers