Interface JdbcClient.GeneratedKeys
- Enclosing interface:
JdbcClient
public static interface JdbcClient.GeneratedKeys
Configures generated key columns and mapping before execution.
The stage preserves column order. It is single use, is not safe for concurrent use, and performs no JDBC work.
When the operation owns the connection, the update may be committed before a terminal operation finishes reading or mapping the generated keys, checking the expected number of keys, or releasing JDBC resources. A terminal failure therefore does not establish that the update was rolled back and must not be retried automatically. When generated key materialization and the update must be atomic, use a client managed by the registry inside a local transaction and let the failure escape the transaction boundary. A directly created client does not join such a transaction.
-
Method Summary
Modifier and TypeMethodDescriptionAdds one generated column requested from JDBC.<T> JdbcClient.Rows<T> map(JdbcClient.RowMapper<T> mapper) Selects the mapper for generated key rows and finalizes this stage.
-
Method Details
-
addColumn
Adds one generated column requested from JDBC.- Parameters:
columnName- generated column name that is not blank- Returns:
- this generated key stage
- Throws:
NullPointerException- if the column name isnullIllegalArgumentException- if the column name is blank or exactly duplicates an existing nameIllegalStateException- if mapping has already been selected
-
map
Selects the mapper for generated key rows and finalizes this stage.- Type Parameters:
T- mapped key type- Parameters:
mapper- generated key row mapper- Returns:
- terminal stage for materialized keys
- Throws:
NullPointerException- if the mapper isnullIllegalStateException- if mapping has already been selected
-