Interface JdbcClient.StatementSpec
- Enclosing interface:
- JdbcClient
-
Method Summary
Modifier and TypeMethodDescriptionBind a positional JDBC statement parameter for "?" placeholder resolution by explicit JDBC statement parameter index.Bind a positional JDBC statement parameter for "?" placeholder resolution by explicit JDBC statement parameter index.Bind a positional JDBC statement parameter for "?" placeholder resolution by implicit order of parameter value registration.Bind a named statement parameter for ":x" placeholder resolution, with each "x" name matching a ":x" placeholder in the SQL statement.Bind a named statement parameter for ":x" placeholder resolution, with each "x" name matching a ":x" placeholder in the SQL statement.Bind a var-args list of positional parameters for "?" placeholder resolution.Bind a list of positional parameters for "?" placeholder resolution.Bind named statement parameters for ":x" placeholder resolution.paramSource
(Object namedParamObject) Bind named statement parameters for ":x" placeholder resolution.paramSource
(SqlParameterSource namedParamSource) Bind named statement parameters for ":x" placeholder resolution.query()
Proceed towards execution of a query, with several result options available in the returned query specification.<T> JdbcClient.MappedQuerySpec<T>
Proceed towards execution of a mapped query, with several options available in the returned query specification.<T> T
query
(ResultSetExtractor<T> rse) Execute a query with the provided SQL statement, returning a result object for the entire ResultSet.void
query
(RowCallbackHandler rch) Execute a query with the provided SQL statement, processing each row with the given callback.<T> JdbcClient.MappedQuerySpec<T>
Proceed towards execution of a mapped query, with several options available in the returned query specification.int
update()
Execute the provided SQL statement as an update.int
Execute the provided SQL statement as an update.int
Execute the provided SQL statement as an update.
-
Method Details
-
param
Bind a positional JDBC statement parameter for "?" placeholder resolution by implicit order of parameter value registration.This is primarily intended for statements with a single parameter or very few parameters, registering each parameter value in the order of the parameter's occurrence in the SQL statement.
- Parameters:
value
- the parameter value to bind- Returns:
- this statement specification (for chaining)
- See Also:
-
param
Bind a positional JDBC statement parameter for "?" placeholder resolution by explicit JDBC statement parameter index.- Parameters:
jdbcIndex
- the JDBC-style index (starting with 1)value
- the parameter value to bind- Returns:
- this statement specification (for chaining)
- See Also:
-
param
Bind a positional JDBC statement parameter for "?" placeholder resolution by explicit JDBC statement parameter index.- Parameters:
jdbcIndex
- the JDBC-style index (starting with 1)value
- the parameter value to bindsqlType
- the associated SQL type (seeTypes
)- Returns:
- this statement specification (for chaining)
- See Also:
-
param
Bind a named statement parameter for ":x" placeholder resolution, with each "x" name matching a ":x" placeholder in the SQL statement.- Parameters:
name
- the parameter namevalue
- the parameter value to bind- Returns:
- this statement specification (for chaining)
- See Also:
-
param
Bind a named statement parameter for ":x" placeholder resolution, with each "x" name matching a ":x" placeholder in the SQL statement.- Parameters:
name
- the parameter namevalue
- the parameter value to bindsqlType
- the associated SQL type (seeTypes
)- Returns:
- this statement specification (for chaining)
- See Also:
-
params
Bind a var-args list of positional parameters for "?" placeholder resolution.The given list will be added to existing positional parameters, if any. Each element from the complete list will be bound as a JDBC positional parameter with a corresponding JDBC index (i.e. list index + 1).
- Parameters:
values
- the parameter values to bind- Returns:
- this statement specification (for chaining)
- See Also:
-
params
Bind a list of positional parameters for "?" placeholder resolution.The given list will be added to existing positional parameters, if any. Each element from the complete list will be bound as a JDBC positional parameter with a corresponding JDBC index (i.e. list index + 1).
- Parameters:
values
- the parameter values to bind- Returns:
- this statement specification (for chaining)
- See Also:
-
params
Bind named statement parameters for ":x" placeholder resolution.The given map will be merged into existing named parameters, if any.
- Parameters:
paramMap
- a map of names and parameter values to bind- Returns:
- this statement specification (for chaining)
- See Also:
-
paramSource
Bind named statement parameters for ":x" placeholder resolution.The given parameter object will define all named parameters based on its JavaBean properties, record components, or raw fields. A Map instance can be provided as a complete parameter source as well.
- Parameters:
namedParamObject
- a custom parameter object (e.g. a JavaBean, record class, or field holder) with named properties serving as statement parameters- Returns:
- this statement specification (for chaining)
- See Also:
-
paramSource
Bind named statement parameters for ":x" placeholder resolution.The given parameter source will define all named parameters, possibly associating specific SQL types with each value.
- Parameters:
namedParamSource
- a customSqlParameterSource
instance- Returns:
- this statement specification (for chaining)
- See Also:
-
query
JdbcClient.ResultQuerySpec query()Proceed towards execution of a query, with several result options available in the returned query specification.- Returns:
- the result query specification
- See Also:
-
query
Proceed towards execution of a mapped query, with several options available in the returned query specification.- Parameters:
mappedClass
- the target class to apply a RowMapper for (either a simple value type for a single column mapping or a JavaBean / record class / field holder for a multi-column mapping)- Returns:
- the mapped query specification
- See Also:
-
query
Proceed towards execution of a mapped query, with several options available in the returned query specification.- Parameters:
rowMapper
- the callback for mapping each row in the ResultSet- Returns:
- the mapped query specification
- See Also:
-
query
Execute a query with the provided SQL statement, processing each row with the given callback.- Parameters:
rch
- a callback for processing each row in the ResultSet- See Also:
-
query
Execute a query with the provided SQL statement, returning a result object for the entire ResultSet.- Parameters:
rse
- a callback for processing the entire ResultSet- Returns:
- the value returned by the ResultSetExtractor
- See Also:
-
update
int update()Execute the provided SQL statement as an update.- Returns:
- the number of rows affected
- See Also:
-
update
Execute the provided SQL statement as an update.This method requires support for generated keys in the JDBC driver.
- Parameters:
generatedKeyHolder
- a KeyHolder that will hold the generated keys (typically aGeneratedKeyHolder
)- Returns:
- the number of rows affected
- See Also:
-
update
Execute the provided SQL statement as an update.This method requires support for generated keys in the JDBC driver.
- Parameters:
generatedKeyHolder
- a KeyHolder that will hold the generated keys (typically aGeneratedKeyHolder
)keyColumnNames
- names of the columns that will have keys generated for them- Returns:
- the number of rows affected
- See Also:
-