Package org.jdbi.v3.core.statement
Class Batch
java.lang.Object
org.jdbi.v3.core.statement.Batch
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Configurable<Batch>
Represents a group of non-prepared statements to be sent to the RDMBS in one "request".
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdd a statement to the batchvoid
close()
int[]
execute()
Execute the batch and return the number of rows affected for each batch part.Returns the configuration registry associated with this object.final StatementContext
Returns the statement context associated with this statement.final Handle
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jdbi.v3.core.config.Configurable
addCustomizer, configure, define, getConfig, registerArgument, registerArgument, registerArrayType, registerArrayType, registerArrayType, registerArrayType, registerCodecFactory, registerCollector, registerColumnMapper, registerColumnMapper, registerColumnMapper, registerColumnMapper, registerColumnMapper, registerColumnMapper, registerExtension, registerRowMapper, registerRowMapper, registerRowMapper, registerRowMapper, setMapKeyColumn, setMapValueColumn, setSqlArrayArgumentStrategy, setSqlLogger, setSqlParser, setTemplateEngine
-
Constructor Details
-
Batch
-
-
Method Details
-
add
Add a statement to the batch- Parameters:
sql
- SQL to be added to the batch, possibly a named statement- Returns:
- the same Batch statement
-
execute
public int[] execute()Execute the batch and return the number of rows affected for each batch part. Note that some database drivers might return special values likeStatement.SUCCESS_NO_INFO
orStatement.EXECUTE_FAILED
.- Returns:
- the number of rows affected per batch part
- See Also:
-
getHandle
-
getConfig
Description copied from interface:Configurable
Returns the configuration registry associated with this object.- Specified by:
getConfig
in interfaceConfigurable<This>
- Returns:
- the configuration registry associated with this object.
-
getContext
Returns the statement context associated with this statement.- Returns:
- the statement context associated with this statement.
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-