recovering from EOF exception

Jonathan Rochkind <[email protected]> Tue, 11 Mar 2003 13:56:52 -0600
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
Let's say I insertObject a new EO, and then try to saveChanges. Upon 
saveChanges, I get an exception. Let's say I am able to determine that this 
is a 'can not insert, duplicate primary key' exception. Let's further say 
that I know what I want to do to respond to this---I want to just forget 
about that damn EO, pretend I never inserted it, remove it from the EC 
entirely, not try to insert it again.

What's the best way to do this?  What I come up with is calling either 
ec.forgetObject (even though the docs tell me never to invoke this 
directly, it somehow seems appropriate) or simply ec.deleteObject (recall 
that this is an object which has NEVER existed in the db; the exception 
occured trying to insert it).  But it's possible neither of those will be 
sufficient at this point. Also there are all the invalidate/refault stuff, 
but that doesn't seem appropriate in this situation with a 
not-succesfully-inserted object, and besides, I try to avoid 
invalidate/refault stuff at all costs myself.

Does anyone have any advice?

--Jonathan