You can mark the base class with XmlTransient .
Up vote 1 down vote favorite 1 share g+ share fb share tw.
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. Jaxb eclipselink moxy link|improve this question asked Apr 25 '11 at 20:47Ed Staub4,551719 79% accept rate.
You can mark the base class with @XmlTransient. @XmlTransient public class Root { } This will cause the Child class to ignore the inheritance (WRT JAXB): public class Child extends Root { } For other examples see: JAX-B How can I ignore a superclass? 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 package example. A; public class MyOwnGrandpa { } example.b. MyOwnGrandpa package example.
B; public class MyOwnGrandpa extends example.a. MyOwnGrandpa { } example. Demo package example; import java.io.
File; import java.io. IOException; import java.util. HashMap; import java.util.
Map; import javax.xml.bind. JAXBContext; import javax.xml.bind. SchemaOutputResolver; import javax.xml.transform.
Result; import javax.xml.transform.stream. StreamResult; import org.eclipse.persistence.jaxb. JAXBContextFactory; import example.b.
MyOwnGrandpa; public class Demo { public static void main(String args) throws Exception { Map properties = new HashMap(1); properties. Put(JAXBContextFactory. ECLIPSELINK_OXM_XML_KEY, new File("src/exanmple/a/binding-a.
Xml")); JAXBContext jc = JAXBContext. NewInstance(new Class {MyOwnGrandpa. Class} , properties); jc.
GenerateSchema(new MySOR()); } private static class MySOR extends SchemaOutputResolver { @Override public Result createOutput(String arg0, String arg1) throws IOException { StreamResult result = new StreamResult(System. Out); result. SetSystemId(arg1); return result; } } } Generated Schema UPDATE This issue is also being discussed on the EclipseLink Forum: http://www.eclipse.org/forums/index.php?t=msg&th=208228&start=0&S=1ec5df3961f963fbc272ab4d94c9c70e.
Blaise, thanks for the quick response. Sorry, I think you probably misunderstood. I don't want the properties of the parent class to disappear - only the class itself.
The public properties of the parent class should appear as if they were declared in the subclass. – Ed Staub Apr 25 '11 at 22:39 @Ed Staub - That is what annotating the parent class @XmlTransient will do. – Blaise Doughan Apr 25 '11 at 22:53 Thanks much.
Unfortunately, ran into a gotcha because parent and child have the same name (in different packages). See forum. – Ed Staub Apr 26 '11 at 19:26 @Ed Staub - The issue you mention on the forum is a bug, above is a way to workaround the issue.
– Blaise Doughan Apr 26 '11 at 20:10.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.