-->
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: Self join with abstract class
PostPosted: Tue Oct 25, 2005 2:44 pm 
Newbie

Joined: Wed Oct 12, 2005 2:50 pm
Posts: 11
I am having some difficulty with this mapping. I have an abstract class TreeNode which maps to a self-joining table called CATEGORY_CHILDREN. The class Category extends TreeNode and maps to the CATEGORY table. Here are the mappings, although the TreeNode can't be mapped like this, because I haven't given it any id. Not sure I am taking the right approach. Any help is appreciated.

<class name="software.executiveutilities.model.TreeNode" table="CATEGORY_CHILDREN" lazy="false">
<one-to-one name="parent" class="software.executiveutilities.model.TreeNode" foreign-key="PARENT_CATEGORY_ID" />
<list name="children" lazy="false" >
<key column="CHILD_CATEGORY_ID" not-null="true" />
<list-index column="CHILD_ORDER" base="0" />
<one-to-many class="software.executiveutilities.model.TreeNode" />
</list>
</class>



<class name="software.executiveutilities.model.Category" table="CATEGORIES" lazy="false">
<id name="id" column="ID">
<generator class="increment" />
</id>
<property name="name" column="NAME" />
<property name="textArea" column="TEXT_AREA" />

<list name="links" lazy="false" cascade="all,delete-orphan" inverse="true">
<key column="CATEGORY_ID" not-null="true" />
<list-index column="LINK_ORDER" base="0" />
<one-to-many class="software.executiveutilities.model.LinkInfo" />
</list>

<list name="images" lazy="false" cascade="all,delete-orphan" inverse="true">
<key column="CATEGORY_ID" not-null="true" />
<list-index column="IMAGE_ORDER" base="0" />
<one-to-many class="software.executiveutilities.model.ImageInfo" />
</list>

<set name="groups" lazy="false" cascade="all,delete-orphan" table="BLUEGROUPS" >
<key column="CATEGORY_ID" not-null="true" />
<one-to-many class="software.executiveutilities.model.Group" />
</set>

</class>


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.