• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Need some advice on handling EO validation errors
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need some advice on handling EO validation errors


  • Subject: Re: Need some advice on handling EO validation errors
  • From: Chuck Hill <email@hidden>
  • Date: Fri, 7 Dec 2007 10:28:47 -0800


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      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Need some advice on handling EO validation errors
      • From: Mike Schrag <email@hidden>
References: 
 >Need some advice on handling EO validation errors (From: Greg Lappen <email@hidden>)

  • Prev by Date: Re: Need some advice on handling EO validation errors
  • Next by Date: Re: EO Caching
  • Previous by thread: Re: Need some advice on handling EO validation errors
  • Next by thread: Re: Need some advice on handling EO validation errors
  • Index(es):
    • Date
    • Thread