-->
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: Nested POJOs to the same table mapping
PostPosted: Mon Nov 28, 2005 11:29 am 
Newbie

Joined: Mon Nov 28, 2005 11:15 am
Posts: 13
Hibernate version:2.0
<class
name="Category"
table="CATEGORY"
>
<id
name="id"
column="ID"
type="java.lang.Long"
unsaved-value="0"
>
<generator class="native">
</generator>
</id>
<property
name="parentId"
type="java.lang.Long"
update="true"
insert="true"
column="PARENT_ID"
not-null="false"
/>
<set
name="children"
.....
</set>

</class>

class Category {
private Long id;
private Long parentId;
private Set children;
....
}

Hi All,
I have the above defined mapping and an equivalent POJO. The table CATEGORY has a column that references a parent category. Thus a category could have children categories that in turn have other children etc.

When working with the example, If I store a parent category that has one level of children everything works correctly, i.e., every childs parentId is set correctly. However, if I store a category that has multiple levels of children it fails to assign the parent id after the first level.

would appreciate any help in the matter. Thanks in advance.


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.