org.opensubsystems.core.persist.db
Class DatabaseOperation

java.lang.Object
  extended by org.opensubsystems.core.persist.db.DatabaseOperation
Direct Known Subclasses:
DatabaseReadOperation, DatabaseUpdateOperation

public abstract class DatabaseOperation
extends java.lang.Object

Base class for adapter to simplify writing of database operations, which should take care of requesting and returning connections, transaction management and exception handling.

Version:
$Id: DatabaseOperation.java,v 1.5 2007/01/07 06:14:18 bastafidli Exp $
Author:
Miro Halas
Code reviewer:
Miro Halas
Code reviewed:
1.1 2005/08/24 06:55:27 bastafidli

Field Summary
protected  java.lang.Object m_data
          Data used for this operation.
protected  DatabaseSchema m_dbschema
          Schema which is executing this operation.
protected  DatabaseFactoryImpl m_factory
          Factory which is executing this operation.
protected  int m_iDataType
          Data type the operation is used for.
protected  java.lang.Object m_returnData
          Attribute to store data to return from executeUpdate.
protected  java.lang.String m_strQuery
          Query specified by the caller to prepare if any.
 
Constructor Summary
DatabaseOperation(DatabaseFactoryImpl factory)
          Constructor to use when the database operation doesn't require any prepared statement.
DatabaseOperation(DatabaseFactoryImpl factory, java.lang.String strQueryToPrepare)
          Constructor to use when database operation doesn't require any prepared statement.
DatabaseOperation(DatabaseFactoryImpl factory, java.lang.String strQueryToPrepare, DatabaseSchema schema, java.lang.Object data, int dataType)
          Full constructor to use when database operation doesn't require any prepared statement.
 
Method Summary
 java.lang.Object getReturnData()
          Get data which should be returned from method which actuall implements database operation
 void setReturnData(java.lang.Object returnData)
          Set data which should be returned from method which actuall implements database operation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_factory

protected DatabaseFactoryImpl m_factory
Factory which is executing this operation.


m_returnData

protected java.lang.Object m_returnData
Attribute to store data to return from executeUpdate.


m_strQuery

protected java.lang.String m_strQuery
Query specified by the caller to prepare if any.


m_dbschema

protected DatabaseSchema m_dbschema
Schema which is executing this operation.


m_iDataType

protected int m_iDataType
Data type the operation is used for.


m_data

protected java.lang.Object m_data
Data used for this operation.

Constructor Detail

DatabaseOperation

public DatabaseOperation(DatabaseFactoryImpl factory)
Constructor to use when the database operation doesn't require any prepared statement.

Parameters:
factory - - factory which is executing this operation

DatabaseOperation

public DatabaseOperation(DatabaseFactoryImpl factory,
                         java.lang.String strQueryToPrepare)
Constructor to use when database operation doesn't require any prepared statement.

Parameters:
factory - - factory which is executing this operation
strQueryToPrepare - - query which should be used to construct prepared statement which will be passed in to executeUpdate

DatabaseOperation

public DatabaseOperation(DatabaseFactoryImpl factory,
                         java.lang.String strQueryToPrepare,
                         DatabaseSchema schema,
                         java.lang.Object data,
                         int dataType)
Full constructor to use when database operation doesn't require any prepared statement.

Parameters:
factory - - factory which is executing this operation
strQueryToPrepare - - query which should be used to construct prepared statement which will be passed in to executeUpdate
schema - - database schema used with this operation
data - - data used for operation
dataType - - data type used with operation
Method Detail

getReturnData

public java.lang.Object getReturnData()
Get data which should be returned from method which actuall implements database operation

Returns:
Object - data set by executeUpdate using set method

setReturnData

public void setReturnData(java.lang.Object returnData)
Set data which should be returned from method which actuall implements database operation

Parameters:
returnData - - data set by executeUpdate using set method


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