I need to generate many classes from my XML Schema (XSD) in a package (.jar).
How can I configure these classes to be serializable?
(I'm using Eclipse and JAX-B)
解决方案
You have to add in your schema aditional namespaces definition to add xjc aditional markup:
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jaxb:extensionBindingPrefixes="xjc"
jaxb:version="1.0">
Then, including an node within :
This will cause that all the concrete classes implement the Serializable interface. Also, you can define the UUID value of the resulting classes (that's an optional attribute).