generating inheritance mapping using the hypejaxb

192 views Asked by At

I am using hypejaxb3, and trying to find the syntax for adding the inheritance. e.g i wants to define the xsd for the relation class Circle inherits Shape . I could find the hyperjaxb customization guide at https://wikis.sun.com/display/GlassFish/Hyperjaxb3Reference but couldnt find specific steps for the defining the inheritance.

1

There are 1 answers

1
lexicore On BEST ANSWER

Just use the XML Schema complex type extension mechanism:

<xsd:complexType name="Shape">
    <xsd:sequence>
        ...
    </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="Cicrle">
    <xsd:complexContent>
        <xsd:extension base="geometry:Shape">
            <xsd:sequence>
                <xsd:element name="radius" type="double"/>
            </xsd:sequence>
        </xsd:extension>
    </xsd:complexContent>
</xsd:complexType>

HJ3 will generate Circle which would extend Shape - as well as appropriate JPA mappings, including inheritance annotations.