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.
|