Skip to content

Adding hook into SQL State based exception translation [SPR-4899] #9575

Closed
@spring-projects-issues

Description

@spring-projects-issues

Abhishek Gupta opened SPR-4899 and commented

REF: #9549 http://jira.springframework.org/browse/SPR-4873

Futher to jira:SPR-4873, there is a need to provide a hook for being able to add new SQL States that might be needed to classify exceptions.

  • Currently, the logic is hardcoded in the SQLStateSQLExceptionTranslator class and if a new SQLState needs to be classified there is no extensible way of doing this. Every database tends to have its own set of SQLStates (eg. Sybase sql-states mentioned in Improve classification of DB2 and Sybase exceptions by adding new error-state classifications [SPR-4873] #9549)

  • A file based approach to override existing SQLState based classification and add new ones would be very useful (The same way it is currently provided for in SQL error-code based classification)

  • Currently the SQLStateSQLExceptionTranslator class classifies into four types of exceptions viz. BadSqlGrammarException, DataIntegrityViolationException, DataAccessResourceFailureException and ConcurrencyFailureException.
    All the exception categories provided in SQLErrorCodeSQLExceptionTranslator need to be provided for SQL State based classification as well.

  • There is no classification for TransientDataAccessResourceException. This needs to be added as well.


Affects: 2.5.2, 2.5.3, 2.5.4

Issue Links:

Referenced from: commits 9b1edea, 49549d6

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: dataIssues in data modules (jdbc, orm, oxm, tx)type: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions