org.opensubsystems.core.persist.db
Class DatabaseUpdateMultipleDataObjectsOperation
java.lang.Object
org.opensubsystems.core.persist.db.DatabaseOperation
org.opensubsystems.core.persist.db.DatabaseUpdateOperation
org.opensubsystems.core.persist.db.DatabaseUpdateMultipleDataObjectsOperation
- All Implemented Interfaces:
- DatabaseOperations
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();
}
- Version:
- $Id: DatabaseUpdateMultipleDataObjectsOperation.java,v 1.7 2007/01/10 05:10:20 bastafidli Exp $
- Author:
- Julian Legeny
- Code reviewer:
- Miro Halas
- Code reviewed:
- 1.6 2006/07/26 23:44:33 jlegeny
|
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DatabaseUpdateMultipleDataObjectsOperation
public DatabaseUpdateMultipleDataObjectsOperation(DatabaseFactoryImpl factory,
java.lang.String query,
ModifiableDatabaseSchema schema,
java.util.Collection colDataObject)
- Constructor
- Parameters:
factory - - factory which is executing this operationquery - - query to update dataschema - - schema to set the data to the statementcolDataObject - - collection of data objects that will be updated
performOperation
protected void performOperation(DatabaseFactoryImpl dbfactory,
java.sql.Connection cntConnection,
java.sql.PreparedStatement pstmQuery)
throws OSSException,
java.sql.SQLException
- Define content of this method to perform the database operation using the
provided connection and optional prepared statement.
- Overrides:
performOperation in class DatabaseUpdateOperation
- Parameters:
dbfactory - - database factory used for this operationcntConnection - - 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.
- Throws:
OSSException - - an error has occured
java.sql.SQLException - - an error has occured
Copyright © 2003 - 2006 OpenSubsystems s.r.o.