Re: Trapping SQLException in D2W
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