-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: hibernate cascade deletion
PostPosted: Tue Jun 16, 2009 8:57 am 
Newbie

Joined: Tue Jun 16, 2009 8:52 am
Posts: 1
i have one course class and one tutorials class. I couse class i hav a set of tutorials. When i delete course i want the set of tutorials associated with that course aslo to be deleted. when i try to delete couse only the foreign key cid in tutorial table become null but all othere fields of tutorials tabel r intact
i course.hbb.xml contains
<set cascade="delete,delete-orphan,all" name="tutorials" order-by="created_date desc">
<key column="cid"/>
<one-to-many class="org.psl.cms.DAO.Tutorials"/>
</set>

and tutorials.hbm.xml contains


<hibernate-mapping>
<class catalog="CMS" name="org.psl.cms.DAO.Course" table="course">
<id name="cid" type="int">
<column name="cid"/>
<generator class="increment"/>
</id>
<property name="cname" type="string">
<column length="50" name="cname"/>
</property>
<property name="details" type="string">
<column length="300" name="details"/>
</property>
<property name="trainer" type="string">
<column length="50" name="trainer"/>
</property>
<property name="startdate" type="date">
<column length="10" name="startdate"/>
</property>
<property name="enddate" type="date">
<column length="10" name="enddate"/>
</property>
<property name="lastregdate" type="date">
<column length="10" name="lastregdate"/>
</property>
<property name="lastdregdate" type="date">
<column length="10" name="lastdregdate"/>
</property>
<property name="noseats" type="java.lang.Integer">
<column name="noseats"/>
</property>
<set cascade="delete-orphan,all" inverse="true" name="applications" order-by="apptype desc,appdatetime asc ">
<key column="cid"/>
<one-to-many class="org.psl.cms.DAO.Application"/>
</set>
<set cascade="delete-orphan,all" name="prerequisite">
<key column="cid"/>
<one-to-many class="org.psl.cms.DAO.Prerequisite"/>
</set>
<set cascade="delete,delete-orphan,all" name="tutorials" order-by="created_date desc">
<key column="cid"/>
<one-to-many class="org.psl.cms.DAO.Tutorials"/>
</set>
<set name="parentpost" cascade="all" order-by="ppid asc">
<key column="cid"/>
<one-to-many class="org.psl.cms.DAO.Parentpost"/>
</set>
<set name="accepted_application" where="apptype =2 ">
<key column="cid"/>
<one-to-many class="org.psl.cms.DAO.Application"/>
</set>
</class>
</hibernate-mapping>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.