## org.hibernate.engine.jdbc.batch.internal
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
`protected` `AbstractBatchImpl(BatchKey key, JdbcCoordinator jdbcCoordinator)`

Method Summary
`void` `addObserver(BatchObserver observer)` Adds an observer to this batch.
`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).
`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 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

### 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.

### 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.

  Specified by:
    `getKey` in interface `Batch`
  Returns:
    The batch key.

### addObserver

    public void addObserver(BatchObserver observer)

  Description copied from interface: `Batch`
  Adds an observer to this batch.

  Specified by:
    `addObserver` in interface `Batch`
  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 interface `Batch`
  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.

  Specified by:
    `execute` in interface `Batch`

### 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.

### release

    public void release()

  Description copied from interface: `Batch`
  Used to indicate that the batch instance is no longer needed and that, therefore, it can release its resources.

  Specified by:
    `release` in interface `Batch`

Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.