dcsimg
How can I deserialize a bunch of objects from the same compatible class that were persisted with different serialVersionUIDs?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ciro_Paludet
Posted On:   Monday, March 17, 2008 12:46 AM

I am using a tool that persists some java objects in a database. This tool generates the serialVersionUID for this class. This class has changed few times, but these changes were minor and the objects are still compatible.

The problem is that users were generating instances of this class after different releases, and just now they realized they were not able to read the old objects.

After some investigation we find out that we have three different generations of serialVersionUIDs for the same compatible class. Is it possible to create a readObject method that will read any object independent of its serialVersionUID?

Thanks and regards!

Re: How can I deserialize a bunch of objects from the same compatible class that were persisted with different serialVersionUIDs?

Posted By:   Stephen_McConnell  
Posted On:   Monday, March 17, 2008 09:13 AM

In the java.io package the ObjectInputStream class has "readObject" as a final class. But right below it is a "readObjectOverride" method. Check it out. You may have to write a custom marshaling process.


But I think your problem is deeper than that. It has to do with a development team gone haywire.... In a system, there should not be three different generations of serialVersiouUIDs out there... even though there were just "minor" changes. The ability of Java to handle updates on jar files... and your update cycle needs to be looked at.


Stephen McConnell

About | Sitemap | Contact