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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionAdd a statement to the batchfinal BatchRegisters with the handle for cleaning when the handle is closed.voidclose()final booleanint[]execute()Execute the batch and return the number of rows affected for each batch part.Returns the configuration registry associated with this object.final StatementContextReturns the statement context associated with this statement.final Handlefinal inthashCode()Methods inherited from class java.lang.ObjectgetClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jdbi.v3.core.config.ConfigurableaddCustomizer, configure, define, getConfig, registerArgument, registerArgument, registerArrayType, registerArrayType, registerArrayType, registerArrayType, registerCodecFactory, registerCollector, registerCollector, registerColumnMapper, registerColumnMapper, registerColumnMapper, registerColumnMapper, registerColumnMapper, registerColumnMapper, registerExtension, registerRowMapper, registerRowMapper, registerRowMapper, registerRowMapper, setMapKeyColumn, setMapValueColumn, setSqlArrayArgumentStrategy, setSqlLogger, setSqlParser, setTemplateEngine, setTimingCollector
- 
Constructor Details- 
Batch
 
- 
- 
Method Details- 
addAdd a statement to the batch- Parameters:
- sql- SQL to be added to the batch, possibly a named statement
- Returns:
- the same Batch statement
 
- 
executepublic 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_INFOorStatement.EXECUTE_FAILED.- Returns:
- the number of rows affected per batch part
- See Also:
 
- 
getHandle
- 
getConfigDescription copied from interface:ConfigurableReturns the configuration registry associated with this object.- Specified by:
- getConfigin interface- Configurable<This>
- Returns:
- the configuration registry associated with this object.
 
- 
getContextReturns the statement context associated with this statement.- Returns:
- the statement context associated with this statement.
 
- 
attachToHandleForCleanupRegisters with the handle for cleaning when the handle is closed.
 There are some situations where Statements need to be cleaned up to avoid resource leaks. This method registers the current Statement it with the Handle. If the statement or the context are cleaned by themselves, it will automatically unregister, so in normal operations, resources should not pool for cleanup with the Handle.- Since:
- 3.35.0
 
- 
closepublic void close()- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
- 
equals
- 
hashCodepublic final int hashCode()
 
-