Interface Batch
-
public interface BatchConceptually models a batch. Unlike directly in JDBC, here we add the ability to batch together multiple statements at a time. In the underlying JDBC this correlates to multiplePreparedStatementobjects (one for each DML string) maintained within the batch.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddObserver(BatchObserver observer)Adds an observer to this batch.voidaddToBatch()Indicates completion of the current part of the batch.voidexecute()Execute this batch.java.sql.PreparedStatementgetBatchStatement(java.lang.String sql, boolean callable)Get a statement which is part of the batch, creating if necessary (and storing for next time).BatchKeygetKey()Retrieves the object being used to key (uniquely identify) this batch.voidrelease()Used to indicate that the batch instance is no longer needed and that, therefore, it can release its resources.
-
-
-
Method Detail
-
getKey
BatchKey getKey()
Retrieves the object being used to key (uniquely identify) this batch.- Returns:
- The batch key.
-
addObserver
void addObserver(BatchObserver observer)
Adds an observer to this batch.- Parameters:
observer- The batch observer.
-
getBatchStatement
java.sql.PreparedStatement getBatchStatement(java.lang.String sql, boolean callable)Get a statement which is part of the batch, creating if necessary (and storing for next time).- Parameters:
sql- The SQL statement.callable- Is the SQL statement callable?- Returns:
- The prepared statement instance, representing the SQL statement.
-
addToBatch
void addToBatch()
Indicates completion of the current part of the batch.
-
execute
void execute()
Execute this batch.
-
release
void release()
Used to indicate that the batch instance is no longer needed and that, therefore, it can release its resources.
-
-