• 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: Trapping SQLException in D2W
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trapping SQLException in D2W


  • Subject: Re: Trapping SQLException in D2W
  • From: Ramsey Gurley <email@hidden>
  • Date: Wed, 24 Aug 2011 10:01:02 -0700

On Aug 24, 2011, at 9:45 AM, Chuck Hill wrote:

> Hi Ramsey,
>
> On 2011-08-24, at 9:42 AM, Ramsey Gurley wrote:
>>
>> Just thought I would add that if you are using wonder's database context delegate, you can also provide your own ERXSQLHelper.OracleSQLHelper subclass via a property
>>
>> Oracle.SQLHelper=com.whatever.MyOracleHelper
>>
>> and override the handleDatabaseException method on it to handle the general adaptor exception that happens when the unique constraint fails.
>>
>> As Chuck mentioned, the quality of the message you receive from your database may make this approach useless (ahem... MySQL), but if you can figure out the modeled index from your database exception, this might do the trick.
>>
>> Also, if you do it this way, make sure you call context.rollbackChanges before throwing your validation exception.
>
>
> Wasn't there some problem with this, like it did not work?  Or did you get that fixed?  I recall someone trying this and it ending in unhappiness.
>
>
> Chuck

The main unhappiness I think came from the fact my implementation on MySQL forgot to call context.rollbackChanges.  That's not documented and I only found it after the fact with jad.

I think the basic approach is still a valid one.  I know Postgresql returns an index name, so I would consider this approach with it. I haven't gotten around to trying it tho.

Ramsey _______________________________________________
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

References: 
 >Trapping SQLException in D2W (From: Markus Ruggiero <email@hidden>)
 >Re: Trapping SQLException in D2W (From: Chuck Hill <email@hidden>)
 >Re: Trapping SQLException in D2W (From: Ramsey Gurley <email@hidden>)
 >Re: Trapping SQLException in D2W (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Trapping SQLException in D2W
  • Next by Date: Baffling WOD error
  • Previous by thread: Re: Trapping SQLException in D2W
  • Next by thread: Accessing a file on a network
  • Index(es):
    • Date
    • Thread