We are having trouble mapping the following XML structure:
Code:
<xsd:attributeGroup name="SuperTypeMetadata">
<xsd:attribute ref="j:commentText" use="optional"/>
<xsd:attribute ref="j:sourceIDText" use="optional"/>
</xsd:attributeGroup>
<xsd:complexType name="string">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attributeGroup ref="j:SuperTypeMetadata"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="TextType">
<xsd:simpleContent>
<xsd:extension base="j-xsd:string"/>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="VesselType">
<xsd:complexContent>
<xsd:extension base="j:SuperType">
<xsd:sequence>
<xsd:element name="Age" type="j:TextType" minOccurs="0"/>
<xsd:element name="Flag" type="j:TextType" minOccurs="0"/>
<xsd:element name="IMONumber" type="j:TextType" minOccurs="0"/>
<xsd:element name="Name" type="j:TextType"/>
<xsd:element name="RadioCallSign" type="j:TextType" minOccurs="0"/>
<xsd:element name="Type" type="j:TextType" minOccurs="0"/>
<xsd:element name="USCGOfficialNumber" type="j:TextType" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute ref="id"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
Below is our test mapping that doesn't work.
Code:
<hibernate-mapping>
<class entity-name="Vessel"
table="Vessel"
schema="..."
catalog="..."
node="Vessel">
<id name="sourceIDText" type="string" node="@sourceIDText" >
<column name="vesselId" />
<generator class="guid" />
</id>
<property name="imoNumber" type="string" node="IMONumber">
<column name="imoNumber" length="7" />
</property>
<property name="name" type="string" node="Name">
<column name="name" length="100" />
</property>
<property name="coastGuardNo" type="string" node="USCGOfficialNumber">
<column name="coastGuardNo" length="50" />
</property>
</class>
</hibernate-mapping>
And some test XML:
Code:
<Vessel id="39">
<IMONumber>8619053</IMONumber>
<Name>MSC PERU</Name>
</Vessel>
When we save records with the mapping pasted above, no exceptions are generated by hibernate, but the database has NULL for all the TextType property mappings. Anybody know how I can fix this problem? I can't change the schema I'm using. It was generated from the Global Justice dictionary.
Grant