1 Reply Latest reply: Jun 4, 2012 12:22 PM by gimbal2 RSS

    How to migrate existing data when changing the signature of an entity bean?

    865480
      Hi all,

      We finally ran into a problem that I figured we might. We are a work in progress... we recently did some minor changes to one of our entity beans. This entity is referenced by other beans as well. One of our clients happens to have a bunch of the "old" entity data. We updated their application, but when we deployed, we're naturally getting the issue of deserialization due to the changes of the entity bean code. I think we added a method and a constructor. I regenerated the serial version UID for the changes. I may misunderstand the use of serialversionuid now. I realize the value is different than it was prior to our changes due to the inclusion of a new method and constructor. The data should read in just fine into this entity bean, but I am guessing due to the serailversionuid value, that's causing it to fail?

      I can't dig up a darn thing on this particular issue. We will have minor changes sometimes like this, that need to deploy into a production environment where data exists. How do we migrate the existing data so that it works with the new code? Now..that said, I realize if I have an entity bean with say two properties.. and millions of records stored.. and then I remove one of those properties, rename it, or change it's type (say from String to Long), that would require some sort of migration of the data. I wouldn't think adding a constructor and one more method (not a property get/set methods) would mess up our deployment like this.

      So in all situations, is there a tool or some standard way to migrate data from the old entity signature to the new? Or is it really as tedious as having to write a utility app every time we deploy new changes.. to literally load ALL the old data and copy it into new entity objects and store it?

      Thank you.