|
From: Thomas R. <tho...@tr...> - 2004-07-01 02:35:30
|
I have added CannotAcquireLockException as a category for SQL error
codes translation - we now have six standard categories. I also added
the CannotSerializeTransactionException that we discussed quite a while
ago. These along with the OptimisticLockingFailureException now inherit
from a new ConcurrencyFailureException. The new exception hierarchy for
this branch looks like this:
DataAccessException
|_ ConcurrencyFailureException
|_ OptimisticLockingFailureException (existing class)
|_ CannotAcquireLockException
|_ CannotSerializeTransactionException
Thomas
Rod Johnson wrote:
>Thanks Thomas,
>
>I think this is a really useful feature. It makes Spring JDBC uniquely
>extensible AFAIK.
>
>In previous projects, I've often used a CannotAcquireLockException for
>SELECT FOR UPDATE NOWAIT usage (ORA-54). I think that may be an important
>enough usage to justify including such an exception and the necessary
>mapping in the framework...
>
>Btw, I'm inclined to think that allowing mapping to anything other than
>DataAccessException would be unwise. It would implicitly change the possible
>behaviour of all JDBC usage. Having a catch(DataAccessException) block
>currently guarantees picking up any exceptions; it no longer would. And it's
>not like people are *forced* to catch exceptions they're not interested in.
>
>Rgds
>Rod
>
>----- Original Message -----
>From: "Thomas Risberg" <tho...@tr...>
>To: <spr...@li...>
>Sent: Wednesday, June 30, 2004 2:18 PM
>Subject: [Springframework-developer] Added custom sql error code translation
>
>
>
>
>>I have added new feature for specifying custom translations in the
>>sql-error-codes.xml:
>>
>> <bean id="Oracle"
>>
>>
>class="org.springframework.jdbc.support.SQLErrorCodes">
>
>
>> <property
>>
>>
>>
>name="badSqlGrammarCodes"><value>900,903,904,917,936,942,17006</value></prop
>erty>
>
>
>> <property
>>
>>
>>
>name="dataIntegrityViolationCodes"><value>1,1400,1722,2291</value></property
>
>
>> <property name="customTranslations">
>> <list>
>> <bean
>>class="org.springframework.jdbc.support.CustomSQLErrorCodesTranslation">
>> <property name="errorCodes"><value>942</value></property>
>> <property
>>
>>
>>
>name="exceptionClass"><value>com.mycompany.test.MyCustomException</value></p
>roperty>
>
>
>> </bean>
>> </list>
>> </property>
>> </bean>
>>
>>The custom exception class must currently be a subclass of
>>DataAccessException - I'm considering allowing any runtime exception
>>unless someone objects to that. Right now there is support for the
>>following constructors (String), (String, Throwable), (String,
>>SQLException), (String, String, Throwable) and (String, String,
>>SQLException). If there are two String parameters, the first one gets
>>the task and the second one gets the sql that was used. If there is
>>only one String, it gets the task and the sql concatenated. This is
>>consistent with the current DataAccessException usage.
>>
>>I have added SQLErrorCodes tests and I am still working on the
>>SQLErrorCodeExceptionTranslator tests - I will commit them later today
>>or tomorrow.
>>
>>The order of translation is now:
>>1. call to customTranslate overridden method
>>2. custom translations (your own exception) specified in customized
>>sql-error-codes.xml (!! NEW Feature !!)
>>3. translation of error codes (standard 5 categories) in customized
>>sql-error-codes.xml
>>4. standard translation of codes in standard sql-error-codes.xml
>>5. fallback on sql state translation
>>
>>Thomas
>>
>>
>>-------------------------------------------------------
>>This SF.Net email sponsored by Black Hat Briefings & Training.
>>Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
>>digital self defense, top technical experts, no vendor pitches,
>>unmatched networking opportunities. Visit www.blackhat.com
>>_______________________________________________
>>Springframework-developer mailing list
>>Spr...@li...
>>https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>
>>
>>
>
>
>
>
>-------------------------------------------------------
>This SF.Net email sponsored by Black Hat Briefings & Training.
>Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
>digital self defense, top technical experts, no vendor pitches,
>unmatched networking opportunities. Visit www.blackhat.com
>_______________________________________________
>Springframework-developer mailing list
>Spr...@li...
>https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
>
>
>
|