executeBatch
Generate methods that are executed as batch
A second method taking an array per parameter, adding a batch entry per element and
answering with the int[] the driver gives back. One round trip instead of one per row,
which is the difference between an import that takes a minute and one that takes an hour.
Only writing statements get one — batching a query would have nowhere to put the results. Turn it off for a statement that is never run in bulk, if the extra method bothers you; it costs nothing to leave on.
The method is called what the statement is called plus Batch, which is what lets
insertTenant and insertTenantBatch sit in the same repository.
Configuration Options
Option: ’true'
The default. A batch method sits alongside the single-row one:
public final class TenantRepository {
public int insertTenant(final UUID id, final String slug) {
// ... rest of generated code
}
public int[] insertTenantBatch(final UUID[] id, final String[] slug) {
// ... rest of generated code
}
}
Option: ‘false’
No batch method is generated:
public final class TenantRepository {
public int insertTenant(final UUID id, final String slug) {
// ... rest of generated code
}
}
Related Options
Also in this group: annotations , catchAndRethrow , createConnection , description , executeOnce , generateConnectionOverloads , generateResultRowType , name , parameters , repository , resultRowColumns , resultRowConverter , resultRowType , returningMode , throwOnMultipleResults , type , validateSchema , vendor , writesReturnUpdateCount .
Front Matter
In order to configure this option, place the following code in the front matter of your SQL statement:
-- executeBatch: true
SELECT something
FROM your_database_schema
WHERE some_column = :some_value