Class AbstractBatchImpl
- java.lang.Object
-
- org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl
-
- All Implemented Interfaces:
Batch
- Direct Known Subclasses:
BatchingBatch,NonBatchingBatch
public abstract class AbstractBatchImpl extends Object implements Batch
Convenience base class for implementers of the Batch interface.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractBatchImpl(BatchKey key, JdbcCoordinator jdbcCoordinator)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidabortBatch(Exception cause)voidaddObserver(BatchObserver observer)Adds an observer to this batch.protected voidclearBatch(PreparedStatement statement)protected abstract voiddoExecuteBatch()Perform batch execution..voidexecute()Execute this batch.PreparedStatementgetBatchStatement(String sql, boolean callable)Get a statement which is part of the batch, creating if necessary (and storing for next time).protected JdbcCoordinatorgetJdbcCoordinator()BatchKeygetKey()Retrieves the object being used to key (uniquely identify) this batch.protected LinkedHashMap<String,PreparedStatement>getStatements()Access to the batch's map of statements (keyed by SQL statement string).protected voidnotifyObserversExplicitExecution()Convenience method to notify registered observers of an explicit execution of this batch.protected voidnotifyObserversImplicitExecution()Convenience method to notify registered observers of an implicit execution of this batch.voidrelease()Used to indicate that the batch instance is no longer needed and that, therefore, it can release its resources.protected voidreleaseStatements()protected SqlExceptionHelpersqlExceptionHelper()Convenience access to the SQLException helper.protected SqlStatementLoggersqlStatementLogger()Convenience access to the SQL statement logger.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.engine.jdbc.batch.spi.Batch
addToBatch
-
-
-
-
Constructor Detail
-
AbstractBatchImpl
protected AbstractBatchImpl(BatchKey key, JdbcCoordinator jdbcCoordinator)
-
-
Method Detail
-
getJdbcCoordinator
protected JdbcCoordinator getJdbcCoordinator()
-
doExecuteBatch
protected abstract void doExecuteBatch()
Perform batch execution.. This is called from the explicit execution, but may also be called from elsewhere depending on the exact implementation.
-
sqlExceptionHelper
protected SqlExceptionHelper sqlExceptionHelper()
Convenience access to the SQLException helper.- Returns:
- The underlying SQLException helper.
-
sqlStatementLogger
protected SqlStatementLogger sqlStatementLogger()
Convenience access to the SQL statement logger.- Returns:
- The underlying JDBC services.
-
abortBatch
protected void abortBatch(Exception cause)
-
getStatements
protected LinkedHashMap<String,PreparedStatement> getStatements()
Access to the batch's map of statements (keyed by SQL statement string).- Returns:
- This batch's statements.
-
getKey
public final BatchKey getKey()
Description copied from interface:BatchRetrieves the object being used to key (uniquely identify) this batch.
-
addObserver
public void addObserver(BatchObserver observer)
Description copied from interface:BatchAdds an observer to this batch.- Specified by:
addObserverin interfaceBatch- Parameters:
observer- The batch observer.
-
getBatchStatement
public PreparedStatement getBatchStatement(String sql, boolean callable)
Description copied from interface:BatchGet a statement which is part of the batch, creating if necessary (and storing for next time).- Specified by:
getBatchStatementin interfaceBatch- Parameters:
sql- The SQL statement.callable- Is the SQL statement callable?- Returns:
- The prepared statement instance, representing the SQL statement.
-
execute
public final void execute()
Description copied from interface:BatchExecute this batch.
-
releaseStatements
protected void releaseStatements()
-
clearBatch
protected void clearBatch(PreparedStatement statement)
-
notifyObserversExplicitExecution
protected final void notifyObserversExplicitExecution()
Convenience method to notify registered observers of an explicit execution of this batch.
-
notifyObserversImplicitExecution
protected final void notifyObserversImplicitExecution()
Convenience method to notify registered observers of an implicit execution of this batch.
-
-