Package org.apache.openjpa.jdbc.kernel
Class BatchingPreparedStatementManagerImpl
- java.lang.Object
-
- org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl
-
- 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, _log, _store
-
-
Constructor Summary
Constructors Constructor Description BatchingPreparedStatementManagerImpl(JDBCStore store, java.sql.Connection conn, int batchLimit)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addBatch(java.sql.PreparedStatement ps, RowImpl row, int count)
protected void
batchOrExecuteRow(RowImpl row)
protected int[]
executeBatch(java.sql.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.java.util.List<RowImpl>
getBatchedRows()
java.lang.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, getAutoAssignColNames, getAutoAssignColumns, getExceptions, getGeneratedKeys, getGeneratedKeys, logSQLWarnings, logSQLWarnings, populateAutoAssignCols, populateAutoAssignCols, prepareStatement, prepareStatement, setObjectId, setObjectId
-
-
-
-
Constructor Detail
-
BatchingPreparedStatementManagerImpl
public BatchingPreparedStatementManagerImpl(JDBCStore store, java.sql.Connection conn, int batchLimit)
Constructor. Supply connection.
-
-
Method Detail
-
flushAndUpdate
protected void flushAndUpdate(RowImpl row) throws java.sql.SQLException
Flush the given row immediately or deferred the flush in batch.- Overrides:
flushAndUpdate
in classPreparedStatementManagerImpl
- Throws:
java.sql.SQLException
-
batchOrExecuteRow
protected void batchOrExecuteRow(RowImpl row) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
flushBatch
protected void flushBatch() throws java.sql.SQLException
flush all cached up statements to be executed as a single or batched prepared statements.- Throws:
java.sql.SQLException
-
isBatchDisabled
public boolean isBatchDisabled()
-
setBatchDisabled
public void setBatchDisabled(boolean disableBatch)
-
getBatchLimit
public int getBatchLimit()
-
setBatchLimit
public void setBatchLimit(int batchLimit)
-
getBatchedRows
public java.util.List<RowImpl> getBatchedRows()
-
getBatchedSql
public java.lang.String getBatchedSql()
-
addBatch
protected void addBatch(java.sql.PreparedStatement ps, RowImpl row, int count) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
executeBatch
protected int[] executeBatch(java.sql.PreparedStatement ps) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
-