I work in an application where we need to save objects in XML format and load them later, as soon as necessary. To do this, I used JAXB to marshall and reverse route XML files back to Java classes.
My problem is that I sometimes have to change Java models (adding, renaming or deleting attributes), as a result I will have incompatible saved XML files that cannot be attached to the new form of the class.
To solve this problem, every time I have to make changes, I take a copy of all the classes in a new package (named after its version) and apply the requested changes. And when saving XML, I save its version so that I can decide which package JAXB needs to check in order to unmount this XML.
My question is: is there any other way to implement backward and forward compatibility using JAXB? If there is no other technology that can support this?
java compatibility backwards-compatibility jaxb
Transient
source share