-->
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: deleting
PostPosted: Fri Jan 28, 2005 7:16 am 
Newbie

Joined: Tue Sep 21, 2004 11:21 am
Posts: 8
Hibernate version:2.1.7c
Name and version of the database you are using:mysql 4.*

I have 2 way's of deleting objects one works fine but the other does not.

my question should both way's work?

first one that works fine:

Set answers = user.getAnswers();
for (Iterator iter = answers.iterator(); iter.hasNext();) {
DboAnswer answer = (DboAnswer) iter.next();
if(answer.getQuestion().getAva().equals(registrationNr.getAva())) {
Service.delete(answer);
}
}

second one that gives me an exception:

List answers = RegistrationService.findAnswers(registrationNr, user);
for (Iterator iter = answers.iterator(); iter.hasNext();) {
Service.delete(iter.next());
}

when i commit i get the exception:
15:20:30,928 WARN [HibernateUtil] net.sf.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): 5, of class: nl.chess.svsonline.dbo.DboAnswer
net.sf.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): 5, of class: nl.chess.svsonline.dbo.DboAnswer
at net.sf.hibernate.impl.SessionImpl.forceFlush(SessionImpl.java:761)
...


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.