Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can mark the base class with <a href="http://download.oracle.com/javase/6/docs/api/javax/xml/bind/annotation/XmlTransient.html" rel="nofollow noreferrer">@XmlTransient</a>.</p> <pre><code>@XmlTransient public class Root { } </code></pre> <p>This will cause the Child class to ignore the inheritance (WRT JAXB):</p> <pre><code>public class Child extends Root { } </code></pre> <p>For other examples see:</p> <ul> <li><a href="https://stackoverflow.com/questions/1386192/jax-b-how-can-i-ignore-a-superclass/3187155#3187155">How can I ignore a superclass?</a></li> </ul> <hr/> <p><strong>Follow Up Issue</strong></p> <p>The issue you posted on the forum is a bug. You can workaround it using a binding file like the following:</p> <p><strong>binding-a.xml</strong></p> <p>In the binding file specify a type name for the transient class. This type will not appear in the generated XML schema:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm" package-name="example.a"&gt; &lt;java-types&gt; &lt;java-type name="MyOwnGrandpa" xml-transient="true"&gt; &lt;xml-type name="MyOwnGrandpa2"/&gt; &lt;/java-type&gt; &lt;/java-types&gt; &lt;/xml-bindings&gt; </code></pre> <p><strong>example.a.MyOwnGrandpa</strong></p> <pre><code>package example.a; public class MyOwnGrandpa { } </code></pre> <p><strong>example.b.MyOwnGrandpa</strong></p> <pre><code>package example.b; public class MyOwnGrandpa extends example.a.MyOwnGrandpa { } </code></pre> <p><strong>example.Demo</strong></p> <pre><code>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&lt;String, Object&gt; properties = new HashMap&lt;String, Object&gt;(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; } } } </code></pre> <p><strong>Generated Schema</strong></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;xsd:complexType name="myOwnGrandpa"/&gt; &lt;/xsd:schema&gt; </code></pre> <hr/> <p><strong>UPDATE</strong></p> <p>This issue is also being discussed on the EclipseLink Forum:</p> <ul> <li><a href="http://www.eclipse.org/forums/index.php?t=msg&amp;th=208228&amp;start=0&amp;S=1ec5df3961f963fbc272ab4d94c9c70e" rel="nofollow noreferrer">http://www.eclipse.org/forums/index.php?t=msg&amp;th=208228&amp;start=0&amp;S=1ec5df3961f963fbc272ab4d94c9c70e</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload