Re: ERXValidationException out of a Unique Constraint Violation
Re: ERXValidationException out of a Unique Constraint Violation
- Subject: Re: ERXValidationException out of a Unique Constraint Violation
- From: Timo Hoepfner <email@hidden>
- Date: Tue, 27 May 2008 22:12:43 +0200
Am 27.05.2008 um 20:05 schrieb Chuck Hill:
The thing is, as I expect Paul has found out, is that this won't
work reliably. Something else can add the value to the database
between when you make this check and when the SQL transaction is
committed.
...
On May 27, 2008, at 11:01 AM, Zak Burke wrote:
I wrote some simple "validateUniquenessOf..." methods that you can
stash in a custom EO superclass. The content is pasted below; you can
also just search for "uniquness" on www.wocode.com.
I added Zak's idea to Wonder a while ago
(ERXEOControlUtilities.validateUniquenessOf(...)). There are still
situations, where it cannot work as expected, so you should always add
a corresponding unique constraint in the database.
I thought about handling the EOGeneralAdaptorException caused by a
unique index violation by using a ERXEC delegate, which in turn would
use the DB specific ERXSQLHelper just today, but that one would fail
in other situations...
I really would like to find a "foolproof" solution for this problem
(and another one for a DB agnostic "version=version+1")...
Timo
_______________________________________________
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