Which is the best alternative for Java Serialization?

Posted by Alotor on Stack Overflow See other posts from Stack Overflow or by Alotor
Published on 2008-10-27T07:41:18Z Indexed on 2010/04/29 3:07 UTC
Read the original article Hit count: 384

I'm currently working on a project which needs to persist any kind of objects (of which implementation we don't have any control) so these objects could be recovered afterwards.

We can't implement a ORM because we can't restrict the users of our library at development time.

Our first alternative was to serialize it with the Java default serialization but we had a lot of trouble recovering the objects when the users started to pass different versions of the same object (attributes changed types, names, ...).

We have tried with the XMLEncoder class (transforms an object into a XML), but we have found that there is a lack of functionality (doesn't support Enums for example).

Finally, we also tried JAXB but this impose our users to annotate their classes.

Any good alternative?

© Stack Overflow or respective owner

Related posts about java

Related posts about serialization