[英]hyperjaxb3 : Enumeration questions
我正在尝试使用hyperjaxb3从此处可用的三个.xsd(C14054.xsd,C14054CodeLists.xsd和C14054DataTypes.xsd)创建关系架构,然后从XML <-> Java <-> Relational封送数据。
与我评估过的非常昂贵的商业工具相比,hyperjaxb3在创建关系模式方面做得更好,但是我无法完全使用Enums来完成它。
例如在C14054.xsd中,“提供者”元素引用了“ RECID”
<xs:element name="Provider">
<xs:complexType>
<xs:sequence>
<xs:element ref="RECID" minOccurs="1" maxOccurs="1" />
依次为“ RECIDCodeType”类型
<xs:element name="RECID" type="RECIDCodeType" />
来自C14054CodeLists.xsd
<xs:complexType name="RECIDCodeType">
<xs:simpleContent>
<xs:extension base="RECIDCodeContentType" />
</xs:simpleContent>
扩展了RECIDCodeContentType
<xs:simpleType name="RECIDCodeContentType">
<xs:restriction base="xs:string">
<xs:enumeration value="14054">
<xs:annotation>
<xs:documentation>
<Label>2014/15 AP student record</Label>
</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
即,在Provider.RECID(我更改了bindings.xjb中的列名)的唯一有效条目(在数据库层)可以为'14054'吗?
即可以将14054作为行添加到数据库的Subpurposecodetype.VALUE_列中?
非常感谢任何人都能发出的光芒!
希望这会在将来对其他人有所帮助(感谢lexicore为我指出正确的方向!):
内联解决方案:
<xs:simpleType name="RECIDCodeContentType">
<xs:annotation>
<xs:appinfo>
<hj:id />
</xs:appinfo>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="14054">
<xs:annotation>
<xs:documentation>
<Label>2014/15 AP student record</Label>
</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
外部绑定文件解决方案:
<jaxb:bindings schemaLocation="C14054CodeLists.xsd" node="/xs:schema">
<!-- RECIDCodeType : Make VALUE Primary Key -->
<jaxb:bindings node="xs:simpleType[@name='RECIDCodeContentType']">
<hj:id />
</jaxb:bindings>
</jaxb:bindings>
结果:
@Id
@Column(name = "VALUE_")
public String getValue() {
return value;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.