org.apache.openjpa.jdbc.kernel
Class BatchingPreparedStatementManagerImpl

java.lang.Object
  extended by org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl
      extended by org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl
All Implemented Interfaces:
PreparedStatementManager

public class BatchingPreparedStatementManagerImpl
extends PreparedStatementManagerImpl

Batch prepared statement manager implementation. This prepared statement manager will utilize the JDBC addBatch() and exceuteBatch() to batch the SQL statements together to improve the execution performance.

Author:
Teresa Kan

Field Summary
 
Fields inherited from class org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl
_conn, _dict, _exceptions, _store
 
Constructor Summary
BatchingPreparedStatementManagerImpl(JDBCStore store, Connection conn, int batchLimit)
          Constructor.
 
Method Summary
protected  void addBatch(PreparedStatement ps, RowImpl row, int count)
           
protected  void batchOrExecuteRow(RowImpl row)
           
protected  int[] executeBatch(PreparedStatement ps)
           
protected  void flushAndUpdate(RowImpl row)
          Flush the given row immediately or deferred the flush in batch.
protected  void flushBatch()
          flush all cached up statements to be executed as a single or batched prepared statements.
 List getBatchedRows()
           
 String getBatchedSql()
           
 int getBatchLimit()
           
 boolean isBatchDisabled()
           
 void setBatchDisabled(boolean disableBatch)
           
 void setBatchLimit(int batchLimit)
           
 
Methods inherited from class org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl
executeUpdate, flush, flush, flushInternal, getExceptions, prepareStatement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BatchingPreparedStatementManagerImpl

public BatchingPreparedStatementManagerImpl(JDBCStore store,
                                            Connection conn,
                                            int batchLimit)
Constructor. Supply connection.

Method Detail

flushAndUpdate

protected void flushAndUpdate(RowImpl row)
                       throws SQLException
Flush the given row immediately or deferred the flush in batch.

Overrides:
flushAndUpdate in class PreparedStatementManagerImpl
Throws:
SQLException

batchOrExecuteRow

protected void batchOrExecuteRow(RowImpl row)
                          throws SQLException
Throws:
SQLException

flushBatch

protected void flushBatch()
                   throws SQLException
flush all cached up statements to be executed as a single or batched prepared statements.

Throws:
SQLException

isBatchDisabled

public boolean isBatchDisabled()

setBatchDisabled

public void setBatchDisabled(boolean disableBatch)

getBatchLimit

public int getBatchLimit()

setBatchLimit

public void setBatchLimit(int batchLimit)

getBatchedRows

public List getBatchedRows()

getBatchedSql

public String getBatchedSql()

addBatch

protected void addBatch(PreparedStatement ps,
                        RowImpl row,
                        int count)
                 throws SQLException
Throws:
SQLException

executeBatch

protected int[] executeBatch(PreparedStatement ps)
                      throws SQLException
Throws:
SQLException


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.