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 protected
AbstractBatchImpl(BatchKey key, JdbcCoordinator jdbcCoordinator)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
abortBatch(Exception cause)
void
addObserver(BatchObserver observer)
Adds an observer to this batch.protected void
clearBatch(PreparedStatement statement)
protected abstract void
doExecuteBatch()
Perform batch execution..void
execute()
Execute this batch.PreparedStatement
getBatchStatement(String sql, boolean callable)
Get a statement which is part of the batch, creating if necessary (and storing for next time).protected JdbcCoordinator
getJdbcCoordinator()
BatchKey
getKey()
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 void
notifyObserversExplicitExecution()
Convenience method to notify registered observers of an explicit execution of this batch.protected void
notifyObserversImplicitExecution()
Convenience method to notify registered observers of an implicit execution of this batch.void
release()
Used to indicate that the batch instance is no longer needed and that, therefore, it can release its resources.protected void
releaseStatements()
protected SqlExceptionHelper
sqlExceptionHelper()
Convenience access to the SQLException helper.protected SqlStatementLogger
sqlStatementLogger()
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:Batch
Retrieves the object being used to key (uniquely identify) this batch.
-
addObserver
public void addObserver(BatchObserver observer)
Description copied from interface:Batch
Adds an observer to this batch.- Specified by:
addObserver
in interfaceBatch
- Parameters:
observer
- The batch observer.
-
getBatchStatement
public PreparedStatement getBatchStatement(String sql, boolean callable)
Description copied from interface:Batch
Get a statement which is part of the batch, creating if necessary (and storing for next time).- Specified by:
getBatchStatement
in 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:Batch
Execute 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.
-
-