-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: XML mapping question
PostPosted: Wed May 31, 2006 12:30 pm 
Beginner
Beginner

Joined: Tue May 23, 2006 4:10 pm
Posts: 38
Location: Charleston, SC
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.