posted 17 years ago
Hi,
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<!--
<!DOCTYPE hibernate-mapping SYSTEM "D:\Dtds\hibernate-mapping-2.0.dtd">
-->
<hibernate-mapping package="com.searchscience.domain.category">
<class name="Category"
table="CATEGORY"
lazy="false">
<id name="id"
type="long"
column="CATEGORY_ID"
unsaved-value="null"
access="org.hibernate.property.DirectPropertyAccessor">
<generator class="native"/>
</id>
<property name="name"
type="string"
update="true">
<column name="NAME"
not-null="true"
length="255"
unique-key="UNIQUE_NAME_AT_LEVEL"/>
</property>
<!-- Parent can be null for root categories. -->
<many-to-one name="parentCategory"
cascade="all"
outer-join="true"
foreign-key="FK1_PARENT_CATEGORY_ID">
<column name="PARENT_CATEGORY_ID"
not-null="false"
unique-key="UNIQUE_NAME_AT_LEVEL"/>
</many-to-one>
<set name="childCategories"
cascade="all-delete-orphan"
inverse="true"
batch-size="10" access="org.hibernate.property.DirectPropertyAccessor">
<key column="PARENT_CATEGORY_ID"/>
<one-to-many class="Category"/>
</set>
</class>
</hibernate-mapping>
this is my hbm file. here i am trying to save the record in Category table. i am using the field such as - id, name, parentcategory. the field parentcategory is the foreign key from the category table. i am storing the category id field there.while storing the data i am not facing any problem. but when i am editing the record i doesn't get updated.I used all the types of Cascade. But no use of it. Help me with proper solution.
Regards,
vijay