我有一个 XSD,想将一些属性标记为 XmlTransient,以便这些属性将由 XJC 在 Java 中生成,并被 JAXB 编组和解组忽略。
我可以修改 XSD,但不知道应该在 xs:annotation 标记中添加什么来自定义 JAXB 绑定。
到目前为止,这是我的 XSD
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:hj="http://hyperjaxb3.jvnet.org/ejb/schemas/customizations" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" jaxb:extensionBindingPrefixes="hj orm">
<xs:complexType name="tripRegisterType">
<xs:annotation>
<xs:appinfo>
<hj:entity>
<orm:table name="simplemaketripprocess_tripregistertype" />
</hj:entity>
<hj:generated-id name="tripregistertypeid" />
</xs:appinfo>
</xs:annotation>
<xs:sequence>
<xs:element name="startDate" type="xs:date">
<xs:annotation>
<xs:appinfo>
<hj:basic>
<orm:column name="startDate" column-definition="timestamp" />
</hj:basic>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="endDate" type="xs:date">
<xs:annotation>
<xs:appinfo>
<hj:basic>
<orm:column name="endDate" column-definition="timestamp" />
</hj:basic>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="want_flight" type="xs:boolean" />
<xs:element name="want_hotel" type="xs:boolean" />
<xs:element name="want_car" type="xs:boolean" />
<xs:element name="payAccNumber" type="xs:string" />
<!-- THE NEXT COLOUMS I'D LIKE TO BE XML TRANSIENT-->
<xs:element name="companyid" type="xs:long" />
<xs:element name="groupid" type="xs:long" />
<xs:element name="userid" type="xs:long" />
<xs:element name="username" type="xs:string" />
<xs:element name="createDate" type="xs:date">
<xs:annotation>
<xs:appinfo>
<hj:basic>
<orm:column name="createDate" column-definition="timestamp" />
</hj:basic>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="modifiedDate" type="xs:date">
<xs:annotation>
<xs:appinfo>
<hj:basic>
<orm:column name="modifiedDate" column-definition="timestamp" />
</hj:basic>
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>