Is it possible, using JAXB, probably using MOXy, to “flatten” a base class into its subclass in marshalling, so that the Java inheritance is not visible in the XML? We have many hand-created classes that are based 1-to-1 on generated classes – the base class has no value in the XML.
If it isn’t obvious, we’re using the schemagen feature – starting with the Java, creating a schema.
You can mark the base class with @XmlTransient.
This will cause the Child class to ignore the inheritance (WRT JAXB):
For other examples see:
Follow Up Issue
The issue you posted on the forum is a bug. You can workaround it using a binding file like the following:
binding-a.xml
In the binding file specify a type name for the transient class. This type will not appear in the generated XML schema:
example.a.MyOwnGrandpa
example.b.MyOwnGrandpa
example.Demo
Generated Schema
UPDATE
This issue is also being discussed on the EclipseLink Forum: