RE: EOAdaptorChannel problem
"Clark, Igor" <[email protected]> Wed, 24 Nov 2004 10:31:48 -0000
| Newsgroups | gmane.comp.web.webobjects.devel,gmane.comp.web.webobjects.eof |
|---|---|
| Message-ID | <D808EA148335074698927652E8E5182F056ECD96@ukapphdevmsx01.ukap.astrazeneca.net> |
Morning folks Thanks Chuck, Ricardo - I'm locking the EOEdtingContext but I haven't locked the EODatabaseContext. I'll do that now. Cheers! i -----Original Message----- From: Chuck Hill [mailto:[email protected]] Sent: 23 November 2004 21:53 To: Clark, Igor Cc: '[email protected]'; '[email protected]' Subject: Re: EOAdaptorChannel problem Thou shalt lock. Thou shalt lock your editing context. Thou shalt lock your database context. Thou shalt not trifle with EOF in an unlock state or thou shall suffer most grievous and irreproducible concurrency related problems. :-) Chuck On Nov 23, 2004, at 9:13 AM, Clark, Igor wrote: > Hi there > > I'm using EOAdaptorChannel.deleteRowsDescribedByQualifier(EOQualifier, > EOEntity) to delete a big pile of rows with the deletes cascading to > other > tables. I'm getting my adaptorChannel by doing this: > > EOEditingContext deleteEc = new EOEditingContext(); > EOAdaptorChannel ac = > ((EODatabaseChannel)(EOUtilities.databaseContextForModelNamed(deleteEc, > "MyModel")).availableChannel()).adaptorChannel(); > > Sometimes (not always, never on my desktop box and only sometimes on > the > development test server) deleteRowsDescribedByQualifier throws a > NullPointerException. If so, I catch it and use > adaptorChannel.adaptorContext().rollbackTransaction(), but that in turn > throws an IllegalStateException. On one occasion I also got a > "com.webobjects.jdbcadaptor.JDBCAdaptorException: Cannot > rollbackTransaction() while a fetch is in progress" instead of the > IllegalStateException. > > Looking through the docs, it seems that "Some possible reasons for > failure > are: * The adaptor channel isn't open. * The adaptor channel is in an > invalid state (for example, it's fetching). * An error occurs in the > database server." > > So, I'm taking a guess that this is happening because the > EOEditingContext > I'm starting with uses the same EOObjectStoreCoordinator as other > EOEditingContexts, and that if I just use a new > EOObjectStoreCoordinator in > the initial new EOEditingContext constructor call, I might get round > this > problem (leaving aside for the moment locking and integrity and all the > other issues). Could anybody tell me if they agree or disagree? Would > I be > better just constructing "DELETE FROM ..." SQL and squirting that in, > or > maybe even a stored procedure would be better as it could lock on db > side > etc? > > Thanks for any thoughts > Igor > _______________________________________________ > WebObjects-dev mailing list > [email protected] > http://www.omnigroup.com/mailman/listinfo/webobjects-dev > -- Practical WebObjects - a book for intermediate WebObjects developers who want to increase their overall knowledge of WebObjects, or those who are trying to solve specific application development problems. http://www.global-village.net/products/practical_webobjects