On Dec 7, 2007, at 7:48 AM, Greg Lappen wrote:

Hi all,

I just recently ran into an issue where my application tried to save a new object to the database, the save failed, and every subsequent save failed with the same error. It seems that WebObjects maintains a queue of updates/saves to write to the database, and when one fails, it essentially clogs up the queue because WO keeps trying to save it eveytime someone calls saveChanges() on an editing context. What I'd like to do is set up a global exception handler in my application that runs whenever an exception is not caught by my code, and in that error handler I want to reset the whole EnterpriseObject stack - the cache, the update/save queue, everything

Why stop there? Why not just shell out a 'sudo reboot now' and be _really_ sure.


- so that other work in the application can continue and not worry about cache corruption or anything like that.

Is this possible to do?  Anyone know how to do it?


Honestly, short of terminating the application or actually rebooting the server, I can't think of a _worse_ way to handle this. You really need to get more familiar with EOEditingContext and EOValidation. You code is simply not handling the save process correctly.

The situation you are seeing can also happen if you are editing in the session's default editing context, there is a validation error, and the user clicks away from the page. Rather than worry about all that, I recommend never (or really, really rarely) performing any edits (create, delete, or update) in the session's default editing context. Instead, use a peer editing context specific to the editing process (often that means specific to a page). Note carefully that _you_ are responsible for locking and unlocking peer editing contexts. The _only_ foolproof ways to do this are to use Project Wonder's ERXEC or the MultiECLockManager class.

Chuck

--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects





_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to