-->
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: Parent being deleted before children despite inverse="true"
PostPosted: Tue Jul 14, 2009 11:06 am 
Newbie

Joined: Tue Jul 14, 2009 11:00 am
Posts: 3
Hi Guys,

Believe me, i've read and read and tried and tried :) Hibernate is issuing a delete to my parent Document before it issues a delete to the children Revision. Because revision has a many-to-one not-null="true" on column docId, this causing a constraint exception when the deletion is attempted with getHibernateTemplate().delete(doc) where doc is a fully initialized object + children. I've tried manually iterating and deleting the children but with no success.

How do I ensure that Hibernate deletes the Revision children first?

Snippets below with some details omitted.

Code:
   <class name="Document" table="docs">
      <list name="revisions" inverse="true" cascade="all-delete-orphan">
         <key column="documentID" />
           <list-index column="listOrder"/>   
         <one-to-many class="Revision" />
      </list>      
   </class>

   <class name="Revision" table="revs">
      <many-to-one name="doc" column="docId" not-null="true" />
   </class>


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.