You will have to write your own readObject()
method that can handle the different UIDs.
"Versioning of Serializable Objects" explains what the UID means and what the rules are.
This answer goes into more details.
I tried to find a good example how to write readObject()
for some object that has several UIDs but couldn't find any. There isn't even an example in "Effective Java" by Joshua Bloch. It just says "If you change the UID, you will get an error" but not how to handle this error gracefully.
This question at least comes close: How to deserialize an object persisted in a db now when the object has different serialVersionUID