org.opensubsystems.core.persist.db
Class DatabaseReadSingleDataObjectOperation

java.lang.Object
  extended by org.opensubsystems.core.persist.db.DatabaseOperation
      extended by org.opensubsystems.core.persist.db.DatabaseReadOperation
          extended by org.opensubsystems.core.persist.db.DatabaseReadSingleDataObjectOperation
All Implemented Interfaces:
DatabaseOperations

public class DatabaseReadSingleDataObjectOperation
extends DatabaseReadOperation

Adapter to simplify writing of database reads which read single data object, which takes care of requesting and returning connections, transaction management, query preparation and exception handling.

Version:
$Id: DatabaseReadSingleDataObjectOperation.java,v 1.7 2007/01/28 06:54:42 bastafidli Exp $
Author:
Julian Legeny
Code reviewer:
TODO: Review this code
Code reviewed:

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
DBOP_DELETE, DBOP_INSERT, DBOP_SELECT, DBOP_UPDATE
 
Constructor Summary
DatabaseReadSingleDataObjectOperation(DatabaseFactoryImpl factory, java.lang.String strQuery, DatabaseSchema schema, int iId, int iDomainId)
          Constructor to use when database update doesn't require any prepared statement.
 
Method Summary
protected  java.lang.Object 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.DatabaseReadOperation
executeRead, handleKnownError, handleSQLException, handleUnknownError, prepareQuery
 
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

DatabaseReadSingleDataObjectOperation

public DatabaseReadSingleDataObjectOperation(DatabaseFactoryImpl factory,
                                             java.lang.String strQuery,
                                             DatabaseSchema schema,
                                             int iId,
                                             int iDomainId)
Constructor to use when database update doesn't require any prepared statement.

Parameters:
factory - - factory which is executing this operation
strQuery - - sql query that has to be processed
schema - - database schema used with this operation
iId - - ID of data object to read
iDomainId - - ID of domain the data object belongs to
Method Detail

performOperation

protected java.lang.Object 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 DatabaseReadOperation
Parameters:
dbfactory - - database factory executing 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.
Returns:
Object - data read from the database accessible through getReturnData
Throws:
OSSException - - an error has occured
java.sql.SQLException - - an error has occured


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