-->
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.  [ 2 posts ] 
Author Message
 Post subject: Recursive one-to-many with composite-key
PostPosted: Thu Sep 08, 2005 10:09 am 
Newbie

Joined: Thu Sep 08, 2005 9:34 am
Posts: 8
Hi

I've got the following class which has a two relationships to itself.

many-to-one to its parent. parent
one-to-many to its children. parts

This is the cfg.xml file (which was created using the Hiberate tools)

Code:
<hibernate-mapping>
<!--
        Auto-generated mapping file from
        the hibernate.org cfg2hbm engine
-->
    <class name="Part" table="_part">
        <composite-id name="id" class="PartId">
            <key-property name="partNumber" type="string">
                <column name="partNumber" length="20" />
            </key-property>
            <key-property name="supplier" type="string">
                <column name="supplier" length="20" />
            </key-property>
        </composite-id>
        <many-to-one name="parent" class="Part">
            <column name="parent_PartNumber" length="20" />
            <column name="parent_Supplier" length="20" />
        </many-to-one>
        <property name="description" type="string">
            <column name="description" length="100" />
        </property>
         ...
         ...
        <set name="parts" inverse="true">
           <key>
      <column name="parent_PartNumber" length="20" />
           <column name="parent_Supplier" length="20" />
           </key>
           <one-to-many class="Part"/>
        </set>
    </class>
</hibernate-mapping>


What is basically happening when the Part class is created the many-to-one relationship parent is correctly created.

But for the parts (all the children for this part) the set is not populated.

Any help appriciated.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 13, 2005 11:25 am 
Newbie

Joined: Thu Sep 08, 2005 9:34 am
Posts: 8
Does anybody know how I can delete this post? For some reason there are two of these posts. (This is a duplicate)

Please look at the other post for more info.
Sorry for the inconvenience !!!!!!

Carel


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

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.