org.openware.job.data
Class DefaultDBA

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

public class DefaultDBA
extends BaseDBA

The default implementation of the BaseDBA class. This should be sufficient for most databases that do a reasonable job of maintaining SQL standards.

Version:
$Revision: 1.12 $ $Date: 2001/07/09 04:21:33 $
Author:
Vincent Sheffer
See Also:
Serialized Form

Field Summary
protected static java.lang.String[] TABLE_ALIASES
           
 
Fields inherited from class org.openware.job.data.BaseDBA
converter, debugMode
 
Constructor Summary
protected DefaultDBA(Converter converter)
           
protected DefaultDBA(Converter converter, boolean debugMode)
           
 
Method Summary
 void create(TableRow data, java.sql.Connection conn)
          Create a new row in the database for this TableRow object.
 java.util.Collection findBy(TableRow data, java.sql.Connection conn, java.lang.String whereClause, java.lang.String[] joinTables)
          Find TableRows with the given where clause.
 java.lang.String getLoadStatement(TableRow data)
           
 void load(TableRow data, java.sql.Connection conn)
          Load values from the underlying database to the internal values for this TableRow object.
 MetaData loadMetaData(java.sql.Connection conn)
          Load the MetaData object to the database.
 void remove(TableRow data, java.sql.Connection conn)
          Remove the database row for this TableRow object.
 void store(TableRow data, java.sql.Connection conn)
          Store the data for this TableRow to the underlying database.
 
Methods inherited from class org.openware.job.data.BaseDBA
dbaccessComplete, debug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TABLE_ALIASES

protected static final java.lang.String[] TABLE_ALIASES
Constructor Detail

DefaultDBA

protected DefaultDBA(Converter converter)

DefaultDBA

protected DefaultDBA(Converter converter,
                     boolean debugMode)
Method Detail

create

public void create(TableRow data,
                   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.
Overrides:
create in class BaseDBA
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 void remove(TableRow data,
                   java.sql.Connection conn)
            throws java.sql.SQLException
Remove the database row for this TableRow object.
Overrides:
remove in class BaseDBA
Parameters:
conn - The database connection to use for the query.
Throws:
java.sql.SQLException - if there is an error accessing the database.

findBy

public java.util.Collection findBy(TableRow data,
                                   java.sql.Connection conn,
                                   java.lang.String whereClause,
                                   java.lang.String[] joinTables)
                            throws java.sql.SQLException
Description copied from class: BaseDBA
Find TableRows with the given where clause.
Overrides:
findBy in class BaseDBA

store

public void store(TableRow data,
                  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.
Overrides:
store in class BaseDBA
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 void load(TableRow data,
                 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.

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

getLoadStatement

public java.lang.String getLoadStatement(TableRow data)

loadMetaData

public MetaData loadMetaData(java.sql.Connection conn)
                      throws java.lang.Exception
Load the MetaData object to the database.
Overrides:
loadMetaData in class BaseDBA


Copyright © 2000,2001 Openware. All Rights Reserved.