com.objectwave.persist.broker
Class AccessBroker

java.lang.Object
  |
  +--com.objectwave.persist.AbstractBroker
        |
        +--com.objectwave.persist.broker.RDBBroker
              |
              +--com.objectwave.persist.broker.AccessBroker
All Implemented Interfaces:
Broker

public class AccessBroker
extends RDBBroker

Used for connecting to MS Access database.

Version:
$Id: AccessBroker.java,v 2.3 2002/02/13 21:36:18 dave_hoag Exp $
Author:
Dave Hoag

Nested Class Summary
 
Nested classes inherited from class com.objectwave.persist.broker.RDBBroker
RDBBroker.Test
 
Field Summary
 
Fields inherited from class com.objectwave.persist.broker.RDBBroker
broker, brokerPropertySource, connectionPerThread, connectionPool, pool, resultEngine, saveObjectsStrategy, sqlModifyEngine, sqlQueryEngine, statementFactory, threadLocal
 
Fields inherited from class com.objectwave.persist.AbstractBroker
exceptionConverter, metrics, props, verbose
 
Constructor Summary
AccessBroker()
           
 
Method Summary
 RDBBroker defaultBroker()
          Implemented as an instance method to support method overriding.
protected  void determinePrimaryKey(RDBPersistence pObj)
          Determine the primary key for the provided persistent object.
protected  void generateInsertValues(RDBPersistence pObj)
          Override the default behavior since we can not determine pkey prior to insert.
static RDBBroker getDefaultBroker()
          Most systems will have only one database broker.
 void initialize()
          Install our custom object formatter
protected  java.lang.Object nextPrimaryKey(RDBPersistence pObj)
          Access the NEXTVAL function of each table to determine the next primary key for the table named tableName.
 void update(RDBPersistence pObj)
          Builds and executes an update statement.
 void update(SQLInsert sql, RDBPersistence obj)
          Don't include the primary key field as a value in the insert statement.
 
Methods inherited from class com.objectwave.persist.broker.RDBBroker
beginTransaction, checkObjectPool, cleanupSelect, close, commit, constrainWhereClause, count, createAttributeSelect, customizeDetail, defineSelectList, delete, deleteAll, deleteObjects, deleteObjects, dumpSQLException, find, findAttributes, findColumnSqlTypes, findResults, findUnique, finishBuildingQuery, getBrokerPropertySource, getConnection, getDefaultDriverName, getDefaultPrimaryKeyStrategy, getObjectPool, getRDBAdapter, initConfiguration, initializeConnections, initializeConnections, initializeObjectPooling, insert, main, newRDBConnection, removeObjectPooling, rollback, save, saveObjects, setBrokerPropertySource, setDriver, setObjectPool, setUsingObjectPool, update
 
Methods inherited from class com.objectwave.persist.AbstractBroker
convertException, convertException, getExceptionConverter, println, setBrokerProperty, setExceptionConverter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccessBroker

public AccessBroker()
Method Detail

getDefaultBroker

public static RDBBroker getDefaultBroker()
Most systems will have only one database broker. This method is used to support systems of that type.

Returns:
The DefaultBroker value

initialize

public void initialize()
Install our custom object formatter

Overrides:
initialize in class RDBBroker
See Also:
com.objectwave.persist.Broker#getDefaultBroker

update

public void update(RDBPersistence pObj)
            throws QueryException,
                   java.sql.SQLException
Builds and executes an update statement.

Parameters:
pObj -
Throws:
QueryException
java.sql.SQLException

update

public void update(SQLInsert sql,
                   RDBPersistence obj)
Don't include the primary key field as a value in the insert statement.

Overrides:
update in class RDBBroker
Parameters:
sql -
obj -

defaultBroker

public RDBBroker defaultBroker()
Implemented as an instance method to support method overriding.

Overrides:
defaultBroker in class RDBBroker
Returns:
com.objectwave.persist.RDBBroker or a subclass.
See Also:
BrokerFactory

determinePrimaryKey

protected void determinePrimaryKey(RDBPersistence pObj)
                            throws java.sql.SQLException,
                                   QueryException
Determine the primary key for the provided persistent object. This assumes the primary key has not yet been determined and that the pObj happens to match the highest value the table.

Overrides:
determinePrimaryKey in class RDBBroker
Parameters:
pObj -
Throws:
java.sql.SQLException
QueryException
See Also:
RDBBroker.generateInsertValues(com.objectwave.persist.RDBPersistence)

generateInsertValues

protected void generateInsertValues(RDBPersistence pObj)
                             throws java.sql.SQLException,
                                    QueryException
Override the default behavior since we can not determine pkey prior to insert.

Overrides:
generateInsertValues in class RDBBroker
Parameters:
pObj -
Throws:
java.sql.SQLException
QueryException
See Also:
RDBBroker.nextPrimaryKey(com.objectwave.persist.RDBPersistence)

nextPrimaryKey

protected java.lang.Object nextPrimaryKey(RDBPersistence pObj)
                                   throws java.sql.SQLException,
                                          QueryException
Access the NEXTVAL function of each table to determine the next primary key for the table named tableName. Do a query to determine the highest known pkey. This is a VERY unsafe solution and should only be used on databases that don't support other ways of determining pkey.

Overrides:
nextPrimaryKey in class RDBBroker
Parameters:
pObj -
Returns:
Next available primary key field.
Throws:
java.sql.SQLException
QueryException