✅ 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@JdbcSelectmust 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 a mandatory, non-collection type that can be mapped via@JdbcToJava.- ✅
GENERATED_KEYS: The processor callsgetGeneratedKeys()(default) - ✅
EXECUTE_QUERY: The processor callsexecuteQuery() - return type must be
nonnullorunspecific
- ✅
✅ 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
nonnullorunspecific - supported annotations
- ✅ @JdbcBatchSize on the method or on an parameter for dynamic
- ✅ Define the @JdbcUpdate method in the interface
The processor emits a nested implementation that collects parameters, honours
@JdbcBatchSize(constant or parameter), and delegates toPreparedStatement#addBatch().