3 Replies Latest reply on Sep 10, 2005 9:11 PM by chiba

    Loading class from relaional storage

    ivang

      Hi,

      I have a this problem - a class is serialized and saved in a database a while ago. It is saved as byte[]. Now, this same class in the code branch has a different serialUID than the one serialized before. Also two more fields and methods were added to the new class. Can I use javaassist somehow to inject the changes into the obsolete class. Indeed, when I deploy my ear and try to read the class, the ObjectIntputStream throws Exception as the UID of the class in ear is differen from the one trying to deserialized.

        • 1. Re: Loading class from relaional storage
          chiba

          I don't think you can read an old serialized data in any way
          if you add a new field to that class. What do you
          mean by "inject the changes into the obsolete class"?
          Do you want to convert a serialized data in the database
          to be compatible with a new version of the class?

          • 2. Re: Loading class from relaional storage
            ivang

            Yes, i was hoping to get the byte[], change the SerialUID value, add the new fields and methods, serialize back update the row in the database. Perhaps javaassist is not the way to go here ?

            • 3. Re: Loading class from relaional storage
              chiba

              Unfortunately, Javassist is not a toolkit for editing
              serialized data. It might be a good idea that Javassist
              supports that editing but currently Javassist does not.
              Sorry.