org.openware.job.data
Class BaseDBA

java.lang.Object
  |
  +--org.openware.job.data.BaseDBA
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DefaultDBA

public abstract class BaseDBA
extends java.lang.Object
implements java.io.Serializable

Abstract base class for all database adaptors. Each database adaptor provides the actual SQL queries, translated for each database, that are required by JOB.

Version:
$Revision: 1.11 $ $Date: 2001/04/26 17:42:35 $
Author:
Vincent Sheffer
See Also:
Serialized Form

Field Summary
protected  Converter converter
          The object that holds the type mapping for each database.
protected  boolean debugMode
           
 
Constructor Summary
protected BaseDBA(Converter converter)
           
protected BaseDBA(Converter converter, boolean debugMode)
           
 
Method Summary
abstract  void create(TableRow shell, java.sql.Connection conn)
          Create a new row in the database for this TableRow object.
protected  void dbaccessComplete(java.sql.Connection conn, java.sql.Statement stmt, java.sql.ResultSet rs)
          Clean up a database connection, statement, and/or resultset.
 void debug(java.lang.String msg)
           
abstract  java.util.Collection findBy(TableRow shell, java.sql.Connection conn, java.lang.String whereClause, java.lang.String[] joinTables)
          Find TableRows with the given where clause.
abstract  void load(TableRow shell, java.sql.Connection conn)
          Load values from the underlying database to the internal values for this TableRow object.
abstract  MetaData loadMetaData(java.sql.Connection conn)
          Load the MetaData object to the database.
abstract  void remove(TableRow shell, java.sql.Connection conn)
          Remove the database row for this TableRow object.
abstract  void store(TableRow shell, java.sql.Connection conn)
          Store the data for this TableRow to the underlying database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

converter

protected Converter converter
The object that holds the type mapping for each database.

debugMode

protected boolean debugMode
Constructor Detail

BaseDBA

protected BaseDBA(Converter converter)

BaseDBA

protected BaseDBA(Converter converter,
                  boolean debugMode)
Method Detail

debug

public void debug(java.lang.String msg)

dbaccessComplete

protected void dbaccessComplete(java.sql.Connection conn,
                                java.sql.Statement stmt,
                                java.sql.ResultSet rs)
Clean up a database connection, statement, and/or resultset. If any errors occur closing anything a message is logged but the exception is eaten.
Parameters:
conn - The database connection to close. null if you don't want to close a connection.
stmt - The database statement to close. null if you don't want to close a statement.
rs - The database result set to close. null if you don't want to close a result set.

create

public abstract void create(TableRow shell,
                            java.sql.Connection conn)
                     throws java.sql.SQLException,
                            TableRowException
Create a new row in the database for this TableRow object. A primary key is generated in this method for the TableRow object. The primary key can be accessed via the getPrimaryKey method. This method returns a String representation of the primary key.
Parameters:
conn - The connection to use to access the database.
Throws:
java.sql.SQLException - if an error occurs accessing the database.
TableRowException - if no row is added to the databse. That is, if 'executeUpdate' returns a count of 0.

remove

public abstract void remove(TableRow shell,
                            java.sql.Connection conn)
                     throws java.sql.SQLException
Remove the database row for this TableRow object.
Parameters:
conn - The database connection to use for the query.
Throws:
java.sql.SQLException - if there is an error accessing the database.

findBy

public abstract java.util.Collection findBy(TableRow shell,
                                            java.sql.Connection conn,
                                            java.lang.String whereClause,
                                            java.lang.String[] joinTables)
                                     throws java.sql.SQLException
Find TableRows with the given where clause.

store

public abstract void store(TableRow shell,
                           java.sql.Connection conn)
                    throws java.sql.SQLException,
                           TableRowException,
                           DataIntegrityException
Store the data for this TableRow to the underlying database. First checks that the object version number of the object matches that in the database table row.
Parameters:
conn - The connection to the database.
Throws:
java.sql.SQLException - if there is an error accessing the database.
TableRowException - if no row is added to the databse. That is, if 'executeUpdate' returns a count of 0.
DataIntegrityException - if the object version number of the TableRow object doesn't match that in the database table row.

load

public abstract void load(TableRow shell,
                          java.sql.Connection conn)
                   throws java.sql.SQLException
Load values from the underlying database to the internal values for this TableRow object. You must set the primary key for the TableRow object before calling this method.

NOTE: A side-effect is that the internal values for the TableRow are set to those from the database table row with the primary key set in a previous call to setPrimaryKey.

Parameters:
conn - The connection to the database.
Throws:
java.sql.SQLException - if there is an error accessing the database.

loadMetaData

public abstract MetaData loadMetaData(java.sql.Connection conn)
                               throws java.lang.Exception
Load the MetaData object to the database.


Copyright © 2000,2001 Openware. All Rights Reserved.