Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Property name change casues JaversException, we need 'alias feature' to register old names #178
In the process of developing an application I have had to change a property name in one of my classes. This now leads to an exception being thrown when I try to commit a snapshot of the object to Javers:
Clearing the mongo db of all data associated with the object clears the issue, but obviously this will be problematic with a live system. Is there a way that Javers can deal with property name changes to underlying objects without loosing all historical audit data associated with them?
Currently Javers doesn't support property name changes, but I think it could be very nice feature if you have some ideas how to deal with it we could discuss it and prepare some solution :), for now you can execute some script updating Javers sctructures or change your class name and store changes from the beggining.
From an audit point of view, as long as the old property data was available in historical snapshots I would be happy. I guess that may make diffs more difficult, though to me it would seem logical to treat the now missing data as null and maybe store a Change to record when it was noticed that the old property was no longer present.
I haven't browsed the source extensively so I'm not too familiar with Javers internals, but looking at the ManagedClass source, I wonder if there is a way to make it aware of class versions? I was thinking along the lines of storing a Map of per-class property names keyed by Serial Version ID somewhere, with the data persisted somewhere in the schema? The obvious downside to this is that versioned classes using this feature would have to be Serializable.
The property alias idea sounds like a good feature, though would it cope with property deletion as well as re-naming?