Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Flush during cascade is dangerous
PostPosted: Tue Sep 02, 2003 11:13 am 
Beginner
Beginner

Joined: Wed Aug 27, 2003 7:53 am
Posts: 27
Ok, somehow I've run across this. I got a couple of (8) entities mapped in various associations (uni- and bidirectional, one-to-many and one many-to-many mappings, plus 2 subclass mappings out of the 8 entities). I use no transactions, and I mapped most of the association with cascade="all" (our business model dictates so).

Now, when I try to do a plain session.delete (hibernateObject), I get the following exception:
Code:
net.sf.hibernate.HibernateException: Flush during cascade is dangerous - this might occur if an object was deleted and then re-saved by cascade
   at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2001)
   at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:589)
   at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1187)
..


I'd like to know exactly what this error means, usually when it happens, and what should I do to avoid it.. ofc I'd share all details if needed when this problem aint that much typical as I think it is..

thanks,
dyn

_________________
.Digital.Yearning.for.Networked.Assassination.and.Xenocide


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 02, 2003 11:16 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
You must remove a deleted object from any associations mapped with cascade. Or the object will be re-saved at flushtime, which causes problems.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 02, 2003 11:26 am 
Beginner
Beginner

Joined: Wed Aug 27, 2003 7:53 am
Posts: 27
oh well.. I knew it must be something typical. Thanks for the clarification!

_________________
.Digital.Yearning.for.Networked.Assassination.and.Xenocide


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

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.