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: Chuck Hill <email@hidden>
- Date: Tue, 27 May 2008 16:11:38 -0700
On May 27, 2008, at 1:12 PM, Timo Hoepfner wrote:
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...
Which situations?
I really would like to find a "foolproof" solution for this problem
(and another one for a DB agnostic "version=version+1")...
I tried to figure out how to do that a while back, but finally gave
up. You would have to do a lot of low level work or get more clever
than I was feeling at the time. Heck, I bet even Mike can't do it.
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