Interface JdbcClient.BatchSpec
- Enclosing interface:
JdbcClient
public static interface JdbcClient.BatchSpec
A specification for accumulating several sets of parameters for a batch
update, with each set representing the parameters for one statement
execution within the batch.
Parameters are bound in the same fashion as for a single JdbcClient.StatementSpec,
either as JDBC-style positional parameters or as Spring-style named parameters
(but not both within the same batch). A batch entry is completed and a new one
started through add(); the final entry is completed implicitly by
update().
- Since:
- 7.1
- Author:
- Juergen Hoeller, Sam Brannen, Jiri Krokviak, Yanming Zhou
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionadd()Complete the current set of parameters as one batch entry and start a new one for the subsequent parameter bindings.Bind a positional parameter for the current batch entry.Bind a named parameter for the current batch entry.Bind a var-args list of positional parameters for the current batch entry.Bind a list of positional parameters for the current batch entry.Bind named parameters for the current batch entry.paramSource(Object namedParamObject) Provide all named parameters for the current batch entry based on the properties, record components, or fields of the given parameter object.paramSource(SqlParameterSource namedParamSource) Provide all named parameters for the current batch entry through the given parameter source.int[]update()Execute the accumulated sets of parameters as a batch update, completing the current (final) set as the last batch entry.int[]Execute the accumulated sets of parameters as a batch update, completing the current (final) set as the last batch entry, returning generated keys.int[]Execute the accumulated sets of parameters as a batch update, completing the current (final) set as the last batch entry, returning generated keys.
-
Method Details
-
param
Bind a positional parameter for the current batch entry.- Parameters:
value- the parameter value to bind- Returns:
- this batch specification (for chaining)
- See Also:
-
param
Bind a named parameter for the current batch entry.- Parameters:
name- the parameter namevalue- the parameter value to bind- Returns:
- this batch specification (for chaining)
- See Also:
-
params
Bind a var-args list of positional parameters for the current batch entry.- Parameters:
values- the parameter values to bind- Returns:
- this batch specification (for chaining)
- See Also:
-
params
Bind a list of positional parameters for the current batch entry.- Parameters:
values- the parameter values to bind- Returns:
- this batch specification (for chaining)
- See Also:
-
params
Bind named parameters for the current batch entry.- Parameters:
paramMap- a map of names and parameter values to bind- Returns:
- this batch specification (for chaining)
- See Also:
-
paramSource
Provide all named parameters for the current batch entry based on the properties, record components, or fields of the given parameter object.- Parameters:
namedParamObject- a custom parameter object- Returns:
- this batch specification (for chaining)
- See Also:
-
paramSource
Provide all named parameters for the current batch entry through the given parameter source.- Parameters:
namedParamSource- a customSqlParameterSourceinstance- Returns:
- this batch specification (for chaining)
- See Also:
-
add
JdbcClient.BatchSpec add()Complete the current set of parameters as one batch entry and start a new one for the subsequent parameter bindings.- Returns:
- this batch specification (for chaining)
-
update
int[] update()Execute the accumulated sets of parameters as a batch update, completing the current (final) set as the last batch entry.- Returns:
- an array containing the numbers of rows affected by each execution in the batch
(may also contain special JDBC-defined negative values for affected rows such as
Statement.SUCCESS_NO_INFO/Statement.EXECUTE_FAILED) - Throws:
org.springframework.dao.DataAccessException- if there is any problem issuing the update- See Also:
-
update
Execute the accumulated sets of parameters as a batch update, completing the current (final) set as the last batch entry, returning generated keys.- Parameters:
generatedKeyHolder- aKeyHolderthat will hold the generated keys- Returns:
- an array containing the numbers of rows affected by each execution in the batch
(may also contain special JDBC-defined negative values for affected rows such as
Statement.SUCCESS_NO_INFO/Statement.EXECUTE_FAILED) - Throws:
org.springframework.dao.DataAccessException- if there is any problem issuing the update- See Also:
-
update
Execute the accumulated sets of parameters as a batch update, completing the current (final) set as the last batch entry, returning generated keys.- Parameters:
generatedKeyHolder- aKeyHolderthat will hold the generated keyskeyColumnNames- names of the columns that will have keys generated for them- Returns:
- an array containing the numbers of rows affected by each execution in the batch
(may also contain special JDBC-defined negative values for affected rows such as
Statement.SUCCESS_NO_INFO/Statement.EXECUTE_FAILED) - Throws:
org.springframework.dao.DataAccessException- if there is any problem issuing the update- See Also:
-