db based cascade delete

David Teran <[email protected]> Wed, 1 Oct 2003 03:44:22 +0200
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
Hi,

we have a class hierarchy like this: A->>B->>C and we have cascade 
deletion from A to B to C. This takes -time- with EOF, i made tests 
about 1 day for a specific task in a project, way too long. Doing this 
directly in the db is a question about seconds and i wonder what we 
have to do in the app. imagine we have fetched all A entities and the 
fault form relationship to B, the NSArray fired already. Now if we only 
delete A with

NSArray bs = a.toBs();
editingContext.deleteObject(a);
editingContext.saveChanges();
//at this time b's are already delete in the db.
B aB = bs.objectAtIndex(0);
aB.takeValueForKey("aNewValue", "aKey");
aB.editingContext().saveChanges();

OK, this will throw an exception or at least should because aB does not 
exist in the db anymore. So is there a simple solution for this 
situation?

cheers David