From 8a6b09520492d33dab1004090a3c25a3e1a57185 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 4 Feb 2014 17:41:42 +0100 Subject: [PATCH] Polishing Issue: SPR-11386 --- .../springframework/jdbc/core/StatementCreatorUtils.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java index 787b683c78..1c3ada0137 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java @@ -64,17 +64,19 @@ public abstract class StatementCreatorUtils { /** * System property that instructs Spring to ignore {@link java.sql.ParameterMetaData#getParameterType} - * completely, i.e. to never even attempt to retrieve {@link PreparedStatement#getParameterMetaData()}. + * completely, i.e. to never even attempt to retrieve {@link PreparedStatement#getParameterMetaData()} + * for {@link StatementCreatorUtils#setNull} calls. *

The default is "false", trying {@code getParameterType} calls first and falling back to * {@link PreparedStatement#setNull} / {@link PreparedStatement#setObject} calls based on well-known * behavior of common databases. Spring records JDBC drivers with non-working {@code getParameterType} * implementations and won't attempt to call that method for that driver again, always falling back. *

Consider switching this flag to "true" if you experience misbehavior at runtime, e.g. with * a connection pool setting back the {@link PreparedStatement} instance in case of an exception - * thrown from {@code getParameterType} (e.g. on JBoss AS 7). + * thrown from {@code getParameterType} (as reported on JBoss AS 7). */ public static final String IGNORE_GETPARAMETERTYPE_PROPERTY_NAME = "spring.jdbc.getParameterType.ignore"; + static final boolean shouldIgnoreGetParameterType = SpringProperties.getFlag(IGNORE_GETPARAMETERTYPE_PROPERTY_NAME); static final Set driversWithNoSupportForGetParameterType = -- GitLab