Package org.springframework.jdbc.support

# Class SQLErrorCodes

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

public class SQLErrorCodes extends Object
JavaBean for holding JDBC error codes for a particular database. Instances of this class are normally loaded through a bean factory.

Used by Spring's `SQLErrorCodeSQLExceptionTranslator`. The file "sql-error-codes.xml" in this package contains default `SQLErrorCodes` instances for various databases.

Author:
  Thomas Risberg, Juergen Hoeller
See Also:
  - `SQLErrorCodesFactory`
  - `SQLErrorCodeSQLExceptionTranslator`

## Constructor Summary

Constructors
Constructor
Description
`SQLErrorCodes()`

## Method Summary

Modifier and Type
Method
Description
`String[]`
`getBadSqlGrammarCodes()`
`String[]`
`getCannotAcquireLockCodes()`
`String[]`
`getCannotSerializeTransactionCodes()`
`SQLExceptionTranslator`
`getCustomSqlExceptionTranslator()`
`CustomSQLErrorCodesTranslation[]`
`getCustomTranslations()`
`String[]`
`getDataAccessResourceFailureCodes()`
`String`
`getDatabaseProductName()`
`String[]`
`getDatabaseProductNames()`
`String[]`
`getDataIntegrityViolationCodes()`
`String[]`
`getDeadlockLoserCodes()`
`String[]`
`getDuplicateKeyCodes()`
`String[]`
`getInvalidResultSetAccessCodes()`
`String[]`
`getPermissionDeniedCodes()`
`String[]`
`getTransientDataAccessResourceCodes()`
`boolean`
`isUseSqlStateForTranslation()`
`void`
`setBadSqlGrammarCodes(String... badSqlGrammarCodes)`
`void`
`setCannotAcquireLockCodes(String... cannotAcquireLockCodes)`
`void`
`setCannotSerializeTransactionCodes(String... cannotSerializeTransactionCodes)`
`void`
`setCustomSqlExceptionTranslator(SQLExceptionTranslator customSqlExceptionTranslator)`
`void`
`setCustomSqlExceptionTranslatorClass(Class<? extends SQLExceptionTranslator> customTranslatorClass)`
`void`
`setCustomTranslations(CustomSQLErrorCodesTranslation... customTranslations)`
`void`
`setDataAccessResourceFailureCodes(String... dataAccessResourceFailureCodes)`
`void`
`setDatabaseProductName(String databaseProductName)`
Set this property if the database name contains spaces, in which case we can not use the bean name for lookup.
`void`
`setDatabaseProductNames(String... databaseProductNames)`
Set this property to specify multiple database names that contains spaces, in which case we can not use bean names for lookup.
`void`
`setDataIntegrityViolationCodes(String... dataIntegrityViolationCodes)`
`void`
`setDeadlockLoserCodes(String... deadlockLoserCodes)`
`void`
`setDuplicateKeyCodes(String... duplicateKeyCodes)`
`void`
`setInvalidResultSetAccessCodes(String... invalidResultSetAccessCodes)`
`void`
`setPermissionDeniedCodes(String... permissionDeniedCodes)`
`void`
`setTransientDataAccessResourceCodes(String... transientDataAccessResourceCodes)`
`void`
`setUseSqlStateForTranslation(boolean useStateCodeForTranslation)`
Set this property to true for databases that do not provide an error code but that do provide SQL State (this includes PostgreSQL).

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

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

## Constructor Details

### SQLErrorCodes

public SQLErrorCodes()

## Method Details

### setDatabaseProductName

public void setDatabaseProductName(@Nullable String databaseProductName)
Set this property if the database name contains spaces, in which case we can not use the bean name for lookup.

### getDatabaseProductName

@Nullable public String getDatabaseProductName()

### setDatabaseProductNames

public void setDatabaseProductNames(@Nullable String... databaseProductNames)
Set this property to specify multiple database names that contains spaces, in which case we can not use bean names for lookup.

### getDatabaseProductNames

@Nullable public String[] getDatabaseProductNames()

### setUseSqlStateForTranslation

public void setUseSqlStateForTranslation(boolean useStateCodeForTranslation)
Set this property to true for databases that do not provide an error code but that do provide SQL State (this includes PostgreSQL).

### isUseSqlStateForTranslation

public boolean isUseSqlStateForTranslation()

### setBadSqlGrammarCodes

public void setBadSqlGrammarCodes(String... badSqlGrammarCodes)

### getBadSqlGrammarCodes

public String[] getBadSqlGrammarCodes()

### setInvalidResultSetAccessCodes

public void setInvalidResultSetAccessCodes(String... invalidResultSetAccessCodes)

### getInvalidResultSetAccessCodes

public String[] getInvalidResultSetAccessCodes()

### getDuplicateKeyCodes

public String[] getDuplicateKeyCodes()

### setDuplicateKeyCodes

public void setDuplicateKeyCodes(String... duplicateKeyCodes)

### setDataIntegrityViolationCodes

public void setDataIntegrityViolationCodes(String... dataIntegrityViolationCodes)

### getDataIntegrityViolationCodes

public String[] getDataIntegrityViolationCodes()

### setPermissionDeniedCodes

public void setPermissionDeniedCodes(String... permissionDeniedCodes)

### getPermissionDeniedCodes

public String[] getPermissionDeniedCodes()

### setDataAccessResourceFailureCodes

public void setDataAccessResourceFailureCodes(String... dataAccessResourceFailureCodes)

### getDataAccessResourceFailureCodes

public String[] getDataAccessResourceFailureCodes()

### setTransientDataAccessResourceCodes

public void setTransientDataAccessResourceCodes(String... transientDataAccessResourceCodes)

### getTransientDataAccessResourceCodes

public String[] getTransientDataAccessResourceCodes()

### setCannotAcquireLockCodes

public void setCannotAcquireLockCodes(String... cannotAcquireLockCodes)

### getCannotAcquireLockCodes

public String[] getCannotAcquireLockCodes()

### setDeadlockLoserCodes

public void setDeadlockLoserCodes(String... deadlockLoserCodes)

### getDeadlockLoserCodes

public String[] getDeadlockLoserCodes()

### setCannotSerializeTransactionCodes

public void setCannotSerializeTransactionCodes(String... cannotSerializeTransactionCodes)

### getCannotSerializeTransactionCodes

public String[] getCannotSerializeTransactionCodes()

### setCustomTranslations

public void setCustomTranslations(CustomSQLErrorCodesTranslation... customTranslations)

### getCustomTranslations

@Nullable public CustomSQLErrorCodesTranslation[] getCustomTranslations()

### setCustomSqlExceptionTranslatorClass

public void setCustomSqlExceptionTranslatorClass(@Nullable Class<? extends SQLExceptionTranslator> customTranslatorClass)

### setCustomSqlExceptionTranslator

public void setCustomSqlExceptionTranslator(@Nullable SQLExceptionTranslator customSqlExceptionTranslator)

### getCustomSqlExceptionTranslator

@Nullable public SQLExceptionTranslator getCustomSqlExceptionTranslator()