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 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.
e.g. in C14054.xsd, the 'Provider' element references 'RECID'
<xs:element name="Provider">
<xs:complexType>
<xs:sequence>
<xs:element ref="RECID" minOccurs="1" maxOccurs="1" />
which in turn is of TYPE 'RECIDCodeType'
<xs:element name="RECID" type="RECIDCodeType" />
from C14054CodeLists.xsd
<xs:complexType name="RECIDCodeType">
<xs:simpleContent>
<xs:extension base="RECIDCodeContentType" />
</xs:simpleContent>
which extends 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>
- Enumerated types are created in the database as 'lookup tables' with the columns 'HJID' and 'VALUE_'. Is it possible for the Primary Key of the table to be VALUE_, rather than the autonumber HJID?
I.e. can the only valid entry (at the database tier) into Provider.RECID (I changed the column name in bindings.xjb) be '14054'?
- Is it possible for the Enum values to be persisted into the relation tables when the schema is created?
I.e. can 14054 be added as a row to the Subpurposecodetype.VALUE_ column in the database?
Many thanks for any light anybody can shed!