org.apache.ojb.broker.util.batch
Class BatchConnection

java.lang.Object
  extended by org.apache.ojb.broker.util.WrappedConnection
      extended by org.apache.ojb.broker.util.batch.BatchConnection
All Implemented Interfaces:
Connection, Wrapper

public class BatchConnection
extends WrappedConnection

The implementation of Connection which automatically gathers INSERT, UPDATE and DELETE PreparedStatements into batches.

Version:
$Id: BatchConnection.java,v 1.1 2007-08-24 22:17:42 ewestfal Exp $
Author:
Oleg Nitz (olegnitz@apache.org)

Field Summary
 
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
Constructor Summary
BatchConnection(Connection conn, PersistenceBroker broker)
           
 
Method Summary
 void clearBatch()
           
 void commit()
           
 void executeBatch()
           
 void executeBatchIfNecessary()
           
 PreparedStatement prepareStatement(String sql)
           
 PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
           
 void rollback()
           
 void setUseBatchInserts(boolean useBatchInserts)
           
 
Methods inherited from class org.apache.ojb.broker.util.WrappedConnection
activateConnection, checkOpen, clearWarnings, close, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getDelegate, getHoldability, getInnermostDelegate, getMetaData, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, isValid, isWrapperFor, nativeSQL, passivateConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setDelegate, setHoldability, setReadOnly, setSavepoint, setSavepoint, setTransactionIsolation, setTypeMap, toString, unwrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BatchConnection

public BatchConnection(Connection conn,
                       PersistenceBroker broker)
Method Detail

setUseBatchInserts

public void setUseBatchInserts(boolean useBatchInserts)

prepareStatement

public PreparedStatement prepareStatement(String sql)
                                   throws SQLException
Specified by:
prepareStatement in interface Connection
Overrides:
prepareStatement in class WrappedConnection
Throws:
SQLException

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int resultSetType,
                                          int resultSetConcurrency)
                                   throws SQLException
Specified by:
prepareStatement in interface Connection
Overrides:
prepareStatement in class WrappedConnection
Throws:
SQLException

executeBatch

public void executeBatch()
                  throws SQLException
Throws:
SQLException

executeBatchIfNecessary

public void executeBatchIfNecessary()
                             throws SQLException
Throws:
SQLException

clearBatch

public void clearBatch()

commit

public void commit()
            throws SQLException
Specified by:
commit in interface Connection
Overrides:
commit in class WrappedConnection
Throws:
SQLException

rollback

public void rollback()
              throws SQLException
Specified by:
rollback in interface Connection
Overrides:
rollback in class WrappedConnection
Throws:
SQLException


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.