Package org.springframework.jdbc.support

# Class CustomSQLExceptionTranslatorRegistry

java.lang.Object
org.springframework.jdbc.support.CustomSQLExceptionTranslatorRegistry

public final class CustomSQLExceptionTranslatorRegistry extends Object
Registry for custom `SQLExceptionTranslator` instances associated with specific databases allowing for overriding translation based on values contained in the configuration file named "sql-error-codes.xml".

Since:
  3.1.1
Author:
  Thomas Risberg
See Also:
  - `SQLErrorCodesFactory`

## Method Summary

Modifier and Type
Method
Description
`SQLExceptionTranslator`
`findTranslatorForDatabase(String dbName)`
Find a custom translator for the specified database.
`static CustomSQLExceptionTranslatorRegistry`
`getInstance()`
Return the singleton instance.
`void`
`registerTranslator(String dbName, SQLExceptionTranslator translator)`
Register a new custom translator for the specified database name.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### getInstance

public static CustomSQLExceptionTranslatorRegistry getInstance()
Return the singleton instance.

### registerTranslator

public void registerTranslator(String dbName, SQLExceptionTranslator translator)
Register a new custom translator for the specified database name.

Parameters:
  `dbName` - the database name
  `translator` - the custom translator

### findTranslatorForDatabase

@Nullable public SQLExceptionTranslator findTranslatorForDatabase(String dbName)
Find a custom translator for the specified database.

Parameters:
  `dbName` - the database name
Returns:
  the custom translator, or `null` if none found