• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Hibernate Cascade  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the Object Relational mapping forum.

Dave
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!