-->
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.  [ 4 posts ] 
Author Message
 Post subject: Problems deleting from Many to Many collection
PostPosted: Thu Sep 18, 2003 2:35 pm 
Newbie

Joined: Thu Sep 18, 2003 2:26 pm
Posts: 5
I have a table structure like the following:

Organization -- > OrganizationAddresses < -- Address



I have and Organization object which has a mapped many to many relationship using the bag construct to organization addresses. When I try to delete an address from the organization's address list then consequently delete the address itself, I receive the following error message from hibernate and my transaction rolls back.


"Flush during cascade is dangerous - this
might occur if an object was deleted and then re-saved by cascade".


I am stumped on how to solve this problem. Do I have to delete the actual Address object in a separate hibernate transaction?

Any ideas well appreciated.


Shon


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 18, 2003 4:07 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Does the hibernate FAQ applies to you ?
Quote:
Hibernate throws: Flush during cascade is dangerous.

This almost always happens because you forgot to remove a deleted instance from an association with cascading save enabled. You should remove deleted objects from associations before flushing the session.

Does the 8th chapter of Hibernate reference guide help ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 22, 2003 10:07 am 
Thanks for the reply!

Yes, actually it does. I found the problem shortly after posting my question. It turns out that the object that was causing the problem had a problem with the equals implementation which was causing a removal from the collection never to happen. Thus the error.

Thanks for your reply!

Shon


Top
  
 
 Post subject:
PostPosted: Fri Sep 26, 2003 4:59 am 
Beginner
Beginner

Joined: Fri Sep 26, 2003 2:50 am
Posts: 32
Could tell me what you do for this problem in detailed?

Thanks, I met a same problem!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.