Defensively call getParameterType (which might fail for certain statements)

Issue: SPR-15977
This commit is contained in:
Juergen Hoeller 2017-09-20 10:54:49 +02:00
parent ffe80ff002
commit 215e5f5682
1 changed files with 8 additions and 1 deletions

View File

@ -244,7 +244,14 @@ public abstract class StatementCreatorUtils {
boolean useSetObject = false;
Integer sqlTypeToUse = null;
if (!shouldIgnoreGetParameterType) {
sqlTypeToUse = ps.getParameterMetaData().getParameterType(paramIndex);
try {
sqlTypeToUse = ps.getParameterMetaData().getParameterType(paramIndex);
}
catch (SQLException ex) {
if (logger.isDebugEnabled()) {
logger.debug("JDBC getParameterType call failed - using fallback method instead: " + ex);
}
}
}
if (sqlTypeToUse == null) {
// Proceed with database-specific checks