Add note on SQL types with SqlBinaryValue/SqlCharacterValue

Closes gh-34786
This commit is contained in:
Juergen Hoeller
2025-07-28 22:06:38 +02:00
parent 16e99f289c
commit f3832c7262
2 changed files with 17 additions and 6 deletions
@@ -34,12 +34,18 @@ import org.springframework.lang.Nullable;
*
* <p>Designed for use with {@link org.springframework.jdbc.core.JdbcTemplate}
* as well as {@link org.springframework.jdbc.core.simple.JdbcClient}, to be
* passed in as a parameter value wrapping the target content value. Can be
* combined with {@link org.springframework.jdbc.core.SqlParameterValue} for
* specifying a SQL type, for example,
* passed in as a parameter value wrapping the target content value.
*
* <p>Can be combined with {@link org.springframework.jdbc.core.SqlParameterValue}
* for specifying a SQL type, for example,
* {@code new SqlParameterValue(Types.BLOB, new SqlBinaryValue(myContent))}.
* With most database drivers, the type hint is not actually necessary.
*
* <p>Note: Only specify {@code Types.BLOB} in case of an actual BLOB, preferring
* {@code Types.LONGVARBINARY} otherwise. With PostgreSQL, {@code Types.ARRAY}
* has to be specified for BYTEA columns, rather than {@code Types.BLOB}. This
* is in contrast to {@link SqlLobValue} where byte array handling was lenient.
*
* @author Juergen Hoeller
* @since 6.1.4
* @see SqlCharacterValue
@@ -33,12 +33,17 @@ import org.springframework.lang.Nullable;
*
* <p>Designed for use with {@link org.springframework.jdbc.core.JdbcTemplate}
* as well as {@link org.springframework.jdbc.core.simple.JdbcClient}, to be
* passed in as a parameter value wrapping the target content value. Can be
* combined with {@link org.springframework.jdbc.core.SqlParameterValue} for
* specifying a SQL type, for example,
* passed in as a parameter value wrapping the target content value.
*
* <p>Can be combined with {@link org.springframework.jdbc.core.SqlParameterValue}
* for specifying a SQL type, for example,
* {@code new SqlParameterValue(Types.CLOB, new SqlCharacterValue(myContent))}.
* With most database drivers, the type hint is not actually necessary.
*
* <p>Note: Only specify {@code Types.CLOB} in case of an actual CLOB, preferring
* {@code Types.LONGVARCHAR} otherwise. This is in contrast to {@link SqlLobValue}
* where char sequence handling was lenient.
*
* @author Juergen Hoeller
* @since 6.1.4
* @see SqlBinaryValue