Class DatabaseUpdateMultipleDataObjectsOperation

  extended by org.opensubsystems.core.persist.db.DatabaseOperation
      extended by org.opensubsystems.core.persist.db.DatabaseUpdateOperation
          extended by org.opensubsystems.core.persist.db.DatabaseUpdateMultipleDataObjectsOperation
All Implemented Interfaces:

public class DatabaseUpdateMultipleDataObjectsOperation
extends DatabaseUpdateOperation

Adapter to simplify writing of batched database updates, which takes care of requesting and returning connections, transaction management and exception handling. To use this adapter you just need to create an instance of this class and call executeUpdate method. Example of method in factory which creates collection of data using batch update public int create( final Collection colDataObject ) throws OSSException { DatabaseBatchUpdateOperation dbop = new DatabaseBatchUpdateOperation( this, m_schema.getUpdateMyData(), m_schema, dataType, colDataObject); dbop.executeUpdate(); return ((Integer)dbop.getReturnData()).intValue(); }

$Id:,v 1.7 2007/01/10 05:10:20 bastafidli Exp $
Julian Legeny
Code reviewer:
Miro Halas
Code reviewed:
1.6 2006/07/26 23:44:33 jlegeny

Field Summary
Fields inherited from class org.opensubsystems.core.persist.db.DatabaseOperation
m_data, m_dbschema, m_factory, m_iDataType, m_returnData, m_strQuery
Fields inherited from interface org.opensubsystems.core.persist.db.DatabaseOperations
Constructor Summary
DatabaseUpdateMultipleDataObjectsOperation(DatabaseFactoryImpl factory, java.lang.String query, ModifiableDatabaseSchema schema, java.util.Collection colDataObject)
Method Summary
protected  void performOperation(DatabaseFactoryImpl dbfactory, java.sql.Connection cntConnection, java.sql.PreparedStatement pstmQuery)
          Define content of this method to perform the database operation using the provided connection and optional prepared statement.
Methods inherited from class org.opensubsystems.core.persist.db.DatabaseUpdateOperation
executeUpdate, handleKnownError, handleSQLException, handleUnknownError, prepareData, setValuesForInsert, setValuesForUpdate
Methods inherited from class org.opensubsystems.core.persist.db.DatabaseOperation
getReturnData, setReturnData
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public DatabaseUpdateMultipleDataObjectsOperation(DatabaseFactoryImpl factory,
                                                  java.lang.String query,
                                                  ModifiableDatabaseSchema schema,
                                                  java.util.Collection colDataObject)

factory - - factory which is executing this operation
query - - query to update data
schema - - schema to set the data to the statement
colDataObject - - collection of data objects that will be updated
Method Detail


protected void performOperation(DatabaseFactoryImpl dbfactory,
                                java.sql.Connection cntConnection,
                                java.sql.PreparedStatement pstmQuery)
                         throws OSSException,
Define content of this method to perform the database operation using the provided connection and optional prepared statement.

performOperation in class DatabaseUpdateOperation
dbfactory - - database factory used for this operation
cntConnection - - ready to use connection to perform the database operation. No need to return this connection.
pstmQuery - - prepared statement for query passed in as a parameter to the constructor. No need to close this statement. If no query was passed into constructor, this will be null.
OSSException - - an error has occured
java.sql.SQLException - - an error has occured

Copyright © 2003 - 2006 OpenSubsystems s.r.o.