<h3>All generated classes implement Serializable</h3>
Eclipse generated classes with xjc, the Binding Compiler. You have to enable xjc extensions in xsd and configure Eclipse (steps a and b)
In order all the generated classes to implement Serializable (because you may want to save them in a db) then (a) add to xsd:
On Eclipse: right click the xsd > Generate > JAXB classes ... > set package and click Next > Next > Additional Arguments: -extension
<h3>References</h3>
http://download.oracle.com/docs/cd/E17802_01/webservices/webservices/docs/1.6/jaxb/vendorCustomizations.html#serializable
http://stackoverflow.com/questions/3677088/how-to-generate-classes-from-xsd-that-implements-serializable
xjc
Eclipse generated classes with xjc, the Binding Compiler. You have to enable xjc extensions in xsd and configure Eclipse (steps a and b)
step a: configure xsd
In order all the generated classes to implement Serializable (because you may want to save them in a db) then (a) add to xsd:
<schema ...
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">
<annotation>
<appinfo>
<jaxb:globalBindings generateIsSetMethod="true">
<xjc:serializable uid="12343"/>
</jaxb:globalBindings>
</appinfo>
</annotation>
...
step b: configure Eclipse (xjc)
On Eclipse: right click the xsd > Generate > JAXB classes ... > set package and click Next > Next > Additional Arguments: -extension
<h3>References</h3>
http://download.oracle.com/docs/cd/E17802_01/webservices/webservices/docs/1.6/jaxb/vendorCustomizations.html#serializable
http://stackoverflow.com/questions/3677088/how-to-generate-classes-from-xsd-that-implements-serializable
xjc
No comments:
Post a Comment