✅ JDBC update
@JdbcUpdatedefine a method which will execute SQL updates- create
prepareStatement - fill parameter from the method
- configure statement
- execute and process the
Statement.executeUpdate - process possible generated values and return them
- create
- ✅ the
valueof@JdbcUpdatemust contain a valid SQL select statement with named parameters (:name) as described in param binding - ✅ Return types may be
void,int, orboolean;- ✅
intwill return the result ofexecuteUpdate - ✅
booleanreturnstruewhen at least one row is affected.
- ✅
- ✅ Returning generated values requires
@JdbcReturnGeneratedValues. The method must return anon-null, non-collection type that can be mapped via@JdbcToJava.- ✅
GENERATED_KEYS: The processor callsgetGeneratedKeys()(default) - ✅
EXECUTE_QUERY: The processor callsexecuteQuery() - return type must be
non-nullorunspecific
- ✅
✅ JDBC batch update
Section titled “✅ JDBC batch update”@JdbcUpdateBatchdefine a method which will execute SQL updates in batch ‘mode’- For batch operations, declare the return type as an inner interface extending
JdbcBatch. - the Result must be
non-nullorunspecific - supported annotations
- ✅
@JdbcBatchSizeon the method or on an parameter for dynamic
- ✅
- ✅ Define the
@JdbcUpdatemethod in the interface The processor emits a nested implementation that collects parameters, honours@JdbcBatchSize(constant or parameter), and delegates toPreparedStatement#addBatch().