[英]hyperjaxb3 : Enumeration questions
I am trying to use hyperjaxb3 to create a relational schema from the three .xsd (C14054.xsd, C14054CodeLists.xsd & C14054DataTypes.xsd) available here and then marshal data from XML <-> Java <-> Relational. 我正在尝试使用hyperjaxb3从此处可用的三个.xsd(C14054.xsd,C14054CodeLists.xsd和C14054DataTypes.xsd)创建关系架构,然后从XML <-> Java <-> Relational封送数据。
hyperjaxb3 has already done a better job of creating the relational schema than a very expensive commercial tool I evaluated - but I can't quite get it to do what I want with Enums. 与我评估过的非常昂贵的商业工具相比,hyperjaxb3在创建关系模式方面做得更好,但是我无法完全使用Enums来完成它。
eg in C14054.xsd, the 'Provider' element references 'RECID' 例如在C14054.xsd中,“提供者”元素引用了“ RECID”
<xs:element name="Provider">
<xs:complexType>
<xs:sequence>
<xs:element ref="RECID" minOccurs="1" maxOccurs="1" />
which in turn is of TYPE 'RECIDCodeType' 依次为“ RECIDCodeType”类型
<xs:element name="RECID" type="RECIDCodeType" />
from C14054CodeLists.xsd 来自C14054CodeLists.xsd
<xs:complexType name="RECIDCodeType">
<xs:simpleContent>
<xs:extension base="RECIDCodeContentType" />
</xs:simpleContent>
which extends RECIDCodeContentType 扩展了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>
Ie can the only valid entry (at the database tier) into Provider.RECID (I changed the column name in bindings.xjb) be '14054'? 即,在Provider.RECID(我更改了bindings.xjb中的列名)的唯一有效条目(在数据库层)可以为'14054'吗?
Ie can 14054 be added as a row to the Subpurposecodetype.VALUE_ column in the database? 即可以将14054作为行添加到数据库的Subpurposecodetype.VALUE_列中?
Many thanks for any light anybody can shed! 非常感谢任何人都能发出的光芒!
Hopefully, this will help some other people in the future (thanks lexicore for pointing me in the right direction!): 希望这会在将来对其他人有所帮助(感谢lexicore为我指出正确的方向!):
Inline solution: 内联解决方案:
<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>
External bindings file solution: 外部绑定文件解决方案:
<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>
Result: 结果:
@Id
@Column(name = "VALUE_")
public String getValue() {
return value;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.