Example usage for org.springframework.jdbc.support CustomSQLExceptionTranslatorRegistry getInstance

List of usage examples for org.springframework.jdbc.support CustomSQLExceptionTranslatorRegistry getInstance

Introduction

In this page you can find the example usage for org.springframework.jdbc.support CustomSQLExceptionTranslatorRegistry getInstance.

Prototype

public static CustomSQLExceptionTranslatorRegistry getInstance() 

Source Link

Document

Return the singleton instance.

Usage

From source file:org.springframework.jdbc.support.SQLErrorCodesFactory.java

/**
 * Check the {@link CustomSQLExceptionTranslatorRegistry} for any entries.
 *///w  w  w.  j  ava2  s  .  c  om
private void checkCustomTranslatorRegistry(String databaseName, SQLErrorCodes errorCodes) {
    SQLExceptionTranslator customTranslator = CustomSQLExceptionTranslatorRegistry.getInstance()
            .findTranslatorForDatabase(databaseName);
    if (customTranslator != null) {
        if (errorCodes.getCustomSqlExceptionTranslator() != null && logger.isWarnEnabled()) {
            logger.warn("Overriding already defined custom translator '"
                    + errorCodes.getCustomSqlExceptionTranslator().getClass().getSimpleName() + " with '"
                    + customTranslator.getClass().getSimpleName()
                    + "' found in the CustomSQLExceptionTranslatorRegistry for database '" + databaseName
                    + "'");
        } else if (logger.isInfoEnabled()) {
            logger.info("Using custom translator '" + customTranslator.getClass().getSimpleName()
                    + "' found in the CustomSQLExceptionTranslatorRegistry for database '" + databaseName
                    + "'");
        }
        errorCodes.setCustomSqlExceptionTranslator(customTranslator);
    }
}