Skip to content

Commit 8d743d9

Browse files
committed
Revise documentation notes on getParameterType performance issues
See gh-25679
1 parent 33c031d commit 8d743d9

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java

+6-7
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,11 @@ public abstract class StatementCreatorUtils {
6666
* completely, i.e. to never even attempt to retrieve {@link PreparedStatement#getParameterMetaData()}
6767
* for {@link StatementCreatorUtils#setNull} calls.
6868
* <p>The default is "false", trying {@code getParameterType} calls first and falling back to
69-
* {@link PreparedStatement#setNull} / {@link PreparedStatement#setObject} calls based on well-known
70-
* behavior of common databases. Spring records JDBC drivers with non-working {@code getParameterType}
71-
* implementations and won't attempt to call that method for that driver again, always falling back.
72-
* <p>Consider switching this flag to "true" if you experience misbehavior at runtime, e.g. with
73-
* a connection pool setting back the {@link PreparedStatement} instance in case of an exception
74-
* thrown from {@code getParameterType} (as reported on JBoss AS 7).
69+
* {@link PreparedStatement#setNull} / {@link PreparedStatement#setObject} calls based on
70+
* well-known behavior of common databases.
71+
* <p>Consider switching this flag to "true" if you experience misbehavior at runtime,
72+
* e.g. with connection pool issues in case of an exception thrown from {@code getParameterType}
73+
* (as reported on JBoss AS 7) or in case of performance problems (as reported on PostgreSQL).
7574
*/
7675
public static final String IGNORE_GETPARAMETERTYPE_PROPERTY_NAME = "spring.jdbc.getParameterType.ignore";
7776

@@ -266,7 +265,7 @@ private static void setNull(PreparedStatement ps, int paramIndex, int sqlType, @
266265
}
267266
else if (databaseProductName.startsWith("DB2") ||
268267
jdbcDriverName.startsWith("jConnect") ||
269-
jdbcDriverName.startsWith("SQLServer")||
268+
jdbcDriverName.startsWith("SQLServer") ||
270269
jdbcDriverName.startsWith("Apache Derby")) {
271270
sqlTypeToUse = Types.VARCHAR;
272271
}

src/docs/asciidoc/data-access.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -3379,7 +3379,7 @@ While this usually works well, there is a potential for issues, e.g. with Map-co
33793379
case which may be expensive with your JDBC driver. Please make sure to use a recent driver
33803380
version, and consider setting the "spring.jdbc.getParameterType.ignore" property to "true"
33813381
(as a JVM system property or in a `spring.properties` file in the root of your classpath)
3382-
if you encounter a performance issue, e.g. as reported on Oracle 12c (SPR-16139).
3382+
if you encounter a performance issue (as reported on Oracle 12c, JBoss and PostgreSQL).
33833383
33843384
Alternatively, simply consider specifying the corresponding JDBC types explicitly:
33853385
either via a 'BatchPreparedStatementSetter' as shown above, or via an explicit type

0 commit comments

Comments
 (0)