使用 hypejaxb 生成继承映射

发布于 2024-12-27 20:23:10 字数 258 浏览 1 评论 0原文

我正在使用 hypejaxb3,并试图找到添加继承的语法。例如我想定义关系的 xsd 类 Circle 继承 Shape 。 我可以在 https://wikis.sun.com/display/GlassFish/Hyperjaxb3Reference 找到 hyperjaxb 自定义指南 但找不到定义继承的具体步骤。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

安人多梦 2025-01-03 20:23:10

只需使用 XML Schema 复杂类型扩展机制:

<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 将生成 Circle,它将扩展 Shape - 以及适当的 JPA 映射,包括继承注释。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文