Document JDBC driver requirement for KeyHolder-based update methods
Closes gh-31486
This commit is contained in:
parent
53b937976d
commit
a23375c49d
|
|
@ -933,12 +933,14 @@ public interface JdbcOperations {
|
|||
* <p>Note that the given PreparedStatementCreator has to create a statement
|
||||
* with activated extraction of generated keys (a JDBC 3.0 feature). This can
|
||||
* either be done directly or through using a PreparedStatementCreatorFactory.
|
||||
* <p>This method requires support for generated keys in the JDBC driver.
|
||||
* @param psc a callback that provides SQL and any necessary parameters
|
||||
* @param generatedKeyHolder a KeyHolder that will hold the generated keys
|
||||
* @return the number of rows affected
|
||||
* @throws DataAccessException if there is any problem issuing the update
|
||||
* @see PreparedStatementCreatorFactory
|
||||
* @see org.springframework.jdbc.support.GeneratedKeyHolder
|
||||
* @see java.sql.DatabaseMetaData#supportsGetGeneratedKeys()
|
||||
*/
|
||||
int update(PreparedStatementCreator psc, KeyHolder generatedKeyHolder) throws DataAccessException;
|
||||
|
||||
|
|
@ -1004,7 +1006,8 @@ public interface JdbcOperations {
|
|||
* <p>Note that the given PreparedStatementCreator has to create a statement
|
||||
* with activated extraction of generated keys (a JDBC 3.0 feature). This can
|
||||
* either be done directly or through using a PreparedStatementCreatorFactory.
|
||||
* <p>Will fall back to separate updates on a single PreparedStatement
|
||||
* <p>This method requires support for generated keys in the JDBC driver.
|
||||
* It will fall back to separate updates on a single PreparedStatement
|
||||
* if the JDBC driver does not support batch updates.
|
||||
* @param psc a callback that creates a PreparedStatement given a Connection
|
||||
* @param pss object to set parameters on the PreparedStatement
|
||||
|
|
@ -1016,6 +1019,7 @@ public interface JdbcOperations {
|
|||
* @throws DataAccessException if there is any problem issuing the update
|
||||
* @since 6.1
|
||||
* @see org.springframework.jdbc.support.GeneratedKeyHolder
|
||||
* @see java.sql.DatabaseMetaData#supportsGetGeneratedKeys()
|
||||
*/
|
||||
int[] batchUpdate(PreparedStatementCreator psc, BatchPreparedStatementSetter pss,
|
||||
KeyHolder generatedKeyHolder) throws DataAccessException;
|
||||
|
|
|
|||
|
|
@ -506,6 +506,7 @@ public interface NamedParameterJdbcOperations {
|
|||
/**
|
||||
* Issue an update via a prepared statement, binding the given arguments,
|
||||
* returning generated keys.
|
||||
* <p>This method requires support for generated keys in the JDBC driver.
|
||||
* @param sql the SQL containing named parameters
|
||||
* @param paramSource container of arguments and SQL types to bind to the query
|
||||
* @param generatedKeyHolder a {@link KeyHolder} that will hold the generated keys
|
||||
|
|
@ -513,6 +514,7 @@ public interface NamedParameterJdbcOperations {
|
|||
* @throws DataAccessException if there is any problem issuing the update
|
||||
* @see MapSqlParameterSource
|
||||
* @see org.springframework.jdbc.support.GeneratedKeyHolder
|
||||
* @see java.sql.DatabaseMetaData#supportsGetGeneratedKeys()
|
||||
*/
|
||||
int update(String sql, SqlParameterSource paramSource, KeyHolder generatedKeyHolder)
|
||||
throws DataAccessException;
|
||||
|
|
@ -520,6 +522,7 @@ public interface NamedParameterJdbcOperations {
|
|||
/**
|
||||
* Issue an update via a prepared statement, binding the given arguments,
|
||||
* returning generated keys.
|
||||
* <p>This method requires support for generated keys in the JDBC driver.
|
||||
* @param sql the SQL containing named parameters
|
||||
* @param paramSource container of arguments and SQL types to bind to the query
|
||||
* @param generatedKeyHolder a {@link KeyHolder} that will hold the generated keys
|
||||
|
|
@ -528,6 +531,7 @@ public interface NamedParameterJdbcOperations {
|
|||
* @throws DataAccessException if there is any problem issuing the update
|
||||
* @see MapSqlParameterSource
|
||||
* @see org.springframework.jdbc.support.GeneratedKeyHolder
|
||||
* @see java.sql.DatabaseMetaData#supportsGetGeneratedKeys()
|
||||
*/
|
||||
int update(String sql, SqlParameterSource paramSource, KeyHolder generatedKeyHolder, String[] keyColumnNames)
|
||||
throws DataAccessException;
|
||||
|
|
@ -558,6 +562,7 @@ public interface NamedParameterJdbcOperations {
|
|||
/**
|
||||
* Execute a batch using the supplied SQL statement with the batch of supplied
|
||||
* arguments, returning generated keys.
|
||||
* <p>This method requires support for generated keys in the JDBC driver.
|
||||
* @param sql the SQL statement to execute
|
||||
* @param batchArgs the array of {@link SqlParameterSource} containing the batch of
|
||||
* arguments for the query
|
||||
|
|
@ -568,12 +573,14 @@ public interface NamedParameterJdbcOperations {
|
|||
* @throws DataAccessException if there is any problem issuing the update
|
||||
* @since 6.1
|
||||
* @see org.springframework.jdbc.support.GeneratedKeyHolder
|
||||
* @see java.sql.DatabaseMetaData#supportsGetGeneratedKeys()
|
||||
*/
|
||||
int[] batchUpdate(String sql, SqlParameterSource[] batchArgs, KeyHolder generatedKeyHolder);
|
||||
|
||||
/**
|
||||
* Execute a batch using the supplied SQL statement with the batch of supplied arguments,
|
||||
* returning generated keys.
|
||||
* <p>This method requires support for generated keys in the JDBC driver.
|
||||
* @param sql the SQL statement to execute
|
||||
* @param batchArgs the array of {@link SqlParameterSource} containing the batch of
|
||||
* arguments for the query
|
||||
|
|
@ -585,7 +592,9 @@ public interface NamedParameterJdbcOperations {
|
|||
* @throws DataAccessException if there is any problem issuing the update
|
||||
* @since 6.1
|
||||
* @see org.springframework.jdbc.support.GeneratedKeyHolder
|
||||
* @see java.sql.DatabaseMetaData#supportsGetGeneratedKeys()
|
||||
*/
|
||||
int[] batchUpdate(String sql, SqlParameterSource[] batchArgs, KeyHolder generatedKeyHolder,
|
||||
String[] keyColumnNames);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -282,20 +282,24 @@ public interface JdbcClient {
|
|||
|
||||
/**
|
||||
* Execute the provided SQL statement as an update.
|
||||
* <p>This method requires support for generated keys in the JDBC driver.
|
||||
* @param generatedKeyHolder a KeyHolder that will hold the generated keys
|
||||
* (typically a {@link org.springframework.jdbc.support.GeneratedKeyHolder})
|
||||
* @return the number of rows affected
|
||||
* @see java.sql.PreparedStatement#executeUpdate()
|
||||
* @see java.sql.DatabaseMetaData#supportsGetGeneratedKeys()
|
||||
*/
|
||||
int update(KeyHolder generatedKeyHolder);
|
||||
|
||||
/**
|
||||
* Execute the provided SQL statement as an update.
|
||||
* <p>This method requires support for generated keys in the JDBC driver.
|
||||
* @param generatedKeyHolder a KeyHolder that will hold the generated keys
|
||||
* (typically a {@link org.springframework.jdbc.support.GeneratedKeyHolder})
|
||||
* @param keyColumnNames names of the columns that will have keys generated for them
|
||||
* @return the number of rows affected
|
||||
* @see java.sql.PreparedStatement#executeUpdate()
|
||||
* @see java.sql.DatabaseMetaData#supportsGetGeneratedKeys()
|
||||
*/
|
||||
int update(KeyHolder generatedKeyHolder, String... keyColumnNames);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue