Win a copy of Production-Ready Serverless (Operational Best Practices) this week in the Cloud/Virtualization forum!
  • 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
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

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
 
Hey, sticks and stones baby. And maybe a wee mention of my stuff:
global solutions you can do in your home or backyard
https://coderanch.com/t/708587/global-solutions-home-backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!