List of usage examples for org.springframework.jdbc.support SQLExceptionTranslator getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:org.springframework.jdbc.support.CustomSQLExceptionTranslatorRegistry.java
/** * Register a new custom translator for the specified database name. * @param dbName the database name//from w ww. j a v a 2 s . c om * @param translator the custom translator */ public void registerTranslator(String dbName, SQLExceptionTranslator translator) { SQLExceptionTranslator replaced = translatorMap.put(dbName, translator); if (replaced != null) { logger.warn("Replacing custom translator [" + replaced + "] for database '" + dbName + "' with [" + translator + "]"); } else { logger.info("Adding custom translator of type [" + translator.getClass().getName() + "] for database '" + dbName + "'"); } }
From source file:org.springframework.jdbc.support.SQLErrorCodesFactory.java
/** * Check the {@link CustomSQLExceptionTranslatorRegistry} for any entries. *//*from w w w .j a va 2 s . com*/ 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); } }