我只想将实体的属性设置为 transient 。旧文档[1 HyperJaxb 的 ] 似乎不可用,Github 上的[ 2 ] ]没有帮助我。
我尝试使用可嵌入/可嵌入属性和生成 ID 构造,但没有成功。
我有一个如下模型,我希望在生成的类中将 lastActivityTime 作为 Transient 。目前该字段的注释是我的一次不成功的尝试。
<xsd:complexType name="ProcessInstanceGroupDAO">
<xsd:sequence>
<xsd:element name="Name" type="xsd:string"/>
<xsd:element name="archived" type="xsd:boolean"/>
<xsd:element name="lastActivityTime">
<xsd:annotation>
<xsd:appinfo>
<hj:persistence>
<hj:embeddable merge="false">
<orm:embeddable-attributes>
<orm:transient name="lastActivityTime"></orm:transient>
</orm:embeddable-attributes>
</hj:embeddable>
</hj:persistence>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
[1] confluence.highsource.org/display/HJ3/Customization+Guide
[2] https://github.com/highsource/hyperjaxb3/wiki/Customization_Guide
最佳答案
只需用 <hj:ignored/>
对其进行注释即可。该属性将被注释为 @Transient
.
<xsd:complexType name="ProcessInstanceGroupDAO">
<xsd:sequence>
<xsd:element name="Name" type="xsd:string"/>
<xsd:element name="archived" type="xsd:boolean"/>
<xsd:element name="lastActivityTime">
<xsd:annotation>
<xsd:appinfo>
<hj:ignored/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
免责声明:我是 Hyperjaxb 的作者。不幸的是我不再积极开发它。
关于java - 如何在 HyperJaxb3 中将生成的属性注释为 Transient,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49613586/