File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Hibernate Cascade Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate Cascade" Watch "Hibernate Cascade" New topic
Author

Hibernate Cascade

vijayarumugam kanagavel
Greenhorn

Joined: May 03, 2006
Posts: 1
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
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Moving to the Object Relational mapping forum.

Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate Cascade
 
Similar Threads
1-to-M mapping confusion
How to implement this contraint at the mapping file level ?
Hibernate self referential interigity
id/parent_id fields on same table. Is it possible to map?
many-to-one relationship to non-PK field