• 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
ERXValidationException out of a Unique Constraint Violation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ERXValidationException out of a Unique Constraint Violation


  • Subject: ERXValidationException out of a Unique Constraint Violation
  • From: Paul Stringer <email@hidden>
  • Date: Tue, 27 May 2008 11:45:09 +0200

Hi,

I'm following the PracticalWebObjects advice to handle unique values validation at the database and then handle it in thrown EOGeneralAdaptorExceptions. Wish I'd checked this before I wasted time pre-checking for all this in validateKey() which was my first approach, follow the advice don't do it! :)

First thing I found when implementing this was you don't get a nice EOAdaptorFailureKey on a unique constraint so I'm having to check the error for a 'Integrity constraint violation' string but so far so good. What I wanted then was a nice ERXValidationException with the Value and KeyPath to be able to display something meaningful to the user.

After looking at it, my solution was to check the SQLException out of the Failed EOAdaptorOperation (copying bits from ERXAdaptorUtilities.isOptimisticLockingFailure()) and regex the SQLException .getMessage() for the values. Seemed kinda hacky but maybe because I'm comparing to clean regular EOValidation.

Any better ways to approach this or am I basically on the right track. The only thing I see as a potential problem is that the errors that come back maybe database specific and so therefore the code is not db independant. I'm using FrontBase right now if it makes any difference.

See you in San Francisco!

Paul Stringer
Treasuremytext.com
_______________________________________________
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: ERXValidationException out of a Unique Constraint Violation
      • From: "Zak Burke" <email@hidden>
    • Re: ERXValidationException out of a Unique Constraint Violation
      • From: Chuck Hill <email@hidden>
  • Prev by Date: Re: WOWODC 2008 t-shirts now available!
  • Next by Date: Re: WOWODC 2008 t-shirts now available!
  • Previous by thread: Re: WOWODC 2008 t-shirts now available!
  • Next by thread: Re: ERXValidationException out of a Unique Constraint Violation
  • Index(es):
    • Date
    • Thread