Top Description Fields Constructors Methods
org.hibernate.engine.jdbc.batch.internal

public abstract Class AbstractBatchImpl

extends Object
implements Batch
Class Inheritance
All Implemented Interfaces
org.hibernate.engine.jdbc.batch.spi.Batch
Known Direct Subclasses
org.hibernate.engine.jdbc.batch.internal.BatchingBatch, org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch
Imports
java.sql.PreparedStatement, .SQLException, java.util.LinkedHashMap, .LinkedHashSet, org.jboss.logging.Logger, org.hibernate.engine.jdbc.batch.spi.Batch, .BatchKey, .BatchObserver, org.hibernate.engine.jdbc.spi.JdbcCoordinator, .JdbcServices, .SqlExceptionHelper, .SqlStatementLogger, org.hibernate.internal.CoreMessageLogger, org.hibernate.resource.jdbc.ResourceRegistry

Convenience base class for implementers of the Batch interface.
Authors
Steve Ebersole, Lukasz Antoniak (lukasz dot antoniak at gmail dot com)

Field Summary

Modifier and TypeField and Description
private final JdbcCoordinator
private final BatchKey
private static final CoreMessageLogger
private LinkedHashSet<BatchObserver>
private final SqlExceptionHelper
private final SqlStatementLogger
private LinkedHashMap<String, PreparedStatement>

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected void
public void
addObserver(BatchObserver
The batch observer.
observer
)

Implements org.hibernate.engine.jdbc.batch.spi.Batch.addObserver.

Adds an observer to this batch.
private PreparedStatement
buildBatchStatement(String sql, boolean callable)

protected void
protected abstract void
doExecuteBatch()

Perform batch execution..

public final void
public PreparedStatement
getBatchStatement(String
The SQL statement.
sql
,
boolean
Is the SQL statement callable?
callable
)

Implements org.hibernate.engine.jdbc.batch.spi.Batch.getBatchStatement.

Get a statement which is part of the batch, creating if necessary (and storing for next time).
protected JdbcCoordinator
public final BatchKey
getKey()

Implements org.hibernate.engine.jdbc.batch.spi.Batch.getKey.

Retrieves the object being used to key (uniquely identify) this batch.
protected LinkedHashMap<String, PreparedStatement>

Returns:

This batch's statements.
getStatements
()

Access to the batch's map of statements (keyed by SQL statement string).

protected final void
notifyObserversExplicitExecution()

Convenience method to notify registered observers of an explicit execution of this batch.

protected final void
notifyObserversImplicitExecution()

Convenience method to notify registered observers of an implicit execution of this batch.

public void
release()

Implements org.hibernate.engine.jdbc.batch.spi.Batch.release.

Used to indicate that the batch instance is no longer needed and that, therefore, it can release its resources.
protected void
protected SqlExceptionHelper

Returns:

The underlying SQLException helper.
sqlExceptionHelper
()

Convenience access to the SQLException helper.

protected SqlStatementLogger

Returns:

The underlying JDBC services.
sqlStatementLogger
()

Convenience access to the SQL statement logger.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

jdbcCoordinatorback to summary
private final JdbcCoordinator jdbcCoordinator
keyback to summary
private final BatchKey key
LOGback to summary
private static final CoreMessageLogger LOG
observersback to summary
private LinkedHashSet<BatchObserver> observers
sqlExceptionHelperback to summary
private final SqlExceptionHelper sqlExceptionHelper
sqlStatementLoggerback to summary
private final SqlStatementLogger sqlStatementLogger
statementsback to summary
private LinkedHashMap<String, PreparedStatement> statements

Constructor Detail

AbstractBatchImplback to summary
protected AbstractBatchImpl(BatchKey key, JdbcCoordinator jdbcCoordinator)

Method Detail

abortBatchback to summary
protected void abortBatch(Exception cause)
addObserverback to summary
public void addObserver(BatchObserver observer)

Implements org.hibernate.engine.jdbc.batch.spi.Batch.addObserver.

Doc from org.hibernate.engine.jdbc.batch.spi.Batch.addObserver.

Adds an observer to this batch.

Parameters
observer:BatchObserver

The batch observer.

Annotations
@Override
buildBatchStatementback to summary
private PreparedStatement buildBatchStatement(String sql, boolean callable)
clearBatchback to summary
protected void clearBatch(PreparedStatement statement)
doExecuteBatchback to summary
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.

executeback to summary
public final void execute()

Implements org.hibernate.engine.jdbc.batch.spi.Batch.execute.

Doc from org.hibernate.engine.jdbc.batch.spi.Batch.execute.

Execute this batch.

Annotations
@Override
getBatchStatementback to summary
public PreparedStatement getBatchStatement(String sql, boolean callable)

Implements org.hibernate.engine.jdbc.batch.spi.Batch.getBatchStatement.

Doc from org.hibernate.engine.jdbc.batch.spi.Batch.getBatchStatement.

Get a statement which is part of the batch, creating if necessary (and storing for next time).

Parameters
sql:String

The SQL statement.

callable:boolean

Is the SQL statement callable?

Returns:PreparedStatement

The prepared statement instance, representing the SQL statement.

Annotations
@Override
getJdbcCoordinatorback to summary
protected JdbcCoordinator getJdbcCoordinator()
getKeyback to summary
public final BatchKey getKey()

Implements org.hibernate.engine.jdbc.batch.spi.Batch.getKey.

Doc from org.hibernate.engine.jdbc.batch.spi.Batch.getKey.

Retrieves the object being used to key (uniquely identify) this batch.

Returns:BatchKey

The batch key.

Annotations
@Override
getStatementsback to summary
protected LinkedHashMap<String, PreparedStatement> getStatements()

Access to the batch's map of statements (keyed by SQL statement string).

Returns:LinkedHashMap<String, PreparedStatement>

This batch's statements.

notifyObserversExplicitExecutionback to summary
protected final void notifyObserversExplicitExecution()

Convenience method to notify registered observers of an explicit execution of this batch.

notifyObserversImplicitExecutionback to summary
protected final void notifyObserversImplicitExecution()

Convenience method to notify registered observers of an implicit execution of this batch.

releaseback to summary
public void release()

Implements org.hibernate.engine.jdbc.batch.spi.Batch.release.

Doc from org.hibernate.engine.jdbc.batch.spi.Batch.release.

Used to indicate that the batch instance is no longer needed and that, therefore, it can release its resources.

Annotations
@Override
releaseStatementsback to summary
protected void releaseStatements()
sqlExceptionHelperback to summary
protected SqlExceptionHelper sqlExceptionHelper()

Convenience access to the SQLException helper.

Returns:SqlExceptionHelper

The underlying SQLException helper.

sqlStatementLoggerback to summary
protected SqlStatementLogger sqlStatementLogger()

Convenience access to the SQL statement logger.

Returns:SqlStatementLogger

The underlying JDBC services.