Retry SQLErrorCodesFactory retrieval if DatabaseMetaData access failed
Includes deprecation of JdbcUtils.extractDatabaseMetaData(DataSource, String) in favor of the now generified version of extractDatabaseMetaData(DataSource, DatabaseMetaDataCallback).
Closes gh-25681
Closes gh-25686
@ -147,7 +148,8 @@ public class LocalDataSourceJobStore extends JobStoreCMT {
@@ -147,7 +148,8 @@ public class LocalDataSourceJobStore extends JobStoreCMT {
// No, if HSQL is the platform, we really don't want to use locks...
@ -76,7 +78,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
@@ -76,7 +78,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
@ -120,7 +122,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
@@ -120,7 +122,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
@ -134,7 +136,9 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
@@ -134,7 +136,9 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
this.sqlErrorCodes.get();// try early initialization - otherwise the supplier will retry later
}
/**
@ -146,7 +150,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
@@ -146,7 +150,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
@ -154,7 +158,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
@@ -154,7 +158,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
@ -164,7 +168,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
@@ -164,7 +168,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
*/
@Nullable
publicSQLErrorCodesgetSqlErrorCodes(){
returnthis.sqlErrorCodes;
returnSupplierUtils.resolve(this.sqlErrorCodes);
}
@ -175,7 +179,6 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
@@ -175,7 +179,6 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
logger.debug("Using nested SQLException from the BatchUpdateException");
sqlEx=nestedSqlEx;
}
}
@ -187,8 +190,9 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
@@ -187,8 +190,9 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
}
// Next, try the custom SQLException translator, if available.
@ -198,9 +202,9 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
@@ -198,9 +202,9 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
}
// Check SQLErrorCodes with corresponding error code, if available.
@ -215,7 +219,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
@@ -215,7 +219,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
@ -230,43 +234,43 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
@@ -230,43 +234,43 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
@ -276,7 +280,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
@@ -276,7 +280,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
// We couldn't identify it more precisely - let's hand it over to the SQLState fallback translator.
assertThat(DataIntegrityViolationException.class.isAssignableFrom(dksex.getClass())).as("Not instance of DataIntegrityViolationException").isTrue();
assertThat(DataIntegrityViolationException.class.isInstance(dksex)).as("Not instance of DataIntegrityViolationException").isTrue();
// Test fallback. We assume that no database will ever return this error code,
// but 07xxx will be bad grammar picked up by the fallback SQLState translator
@ -152,14 +160,13 @@ public class SQLErrorCodeSQLExceptionTranslatorTests {
@@ -152,14 +160,13 @@ public class SQLErrorCodeSQLExceptionTranslatorTests {