#5 Create a feature to help the update process between versions

1.3.0
closed
framework (10)
9
2009-08-25
2008-12-13
No

The problem: there is no way to migrate the data contained in the RMS to a new version of the application except if the application don't have any change on the Persistable classes structure, otherwise the RMS data will be read incorrectly leading to inconsistent data or exceptions.

The proposed solution: a class that will help on the migration process. Below I create a scratch of how it can work:

//the Person class had added a new field called specialFood between versions
Person person = new Person();

//it will start the update process and return a list of all Person deserialized into a Map
List<Map> entities = UpdateManager.start(Person.class);

for(..) {
Map entity = entities.get(..);

//here we set the ID of the object being uptaed
UpdateManager.setId(entity, person);

person.setName(entity.get("name"));
person.setGender(entity.get("gender"));

//the new field will be set now
person.setSpecialFood("Barbecue");

//replacing the old person if a new structure data
persistableManager.save(person);
}
//it will finish the process and update the new structure of the Person RMS
UpdateManager.finish(Person.class);

Discussion

  • Thiago Leão Moreira

    • summary: Create a class to help the update process between versions --> Create a feature to help the update process between versions
     
  • Thiago Leão Moreira

    Committed revision 515.

     
  • Thiago Leão Moreira

    • milestone: --> 1.3.0
    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks