|
Expresso 5-5-0 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jcorporate.expresso.core.dataobjects.jdbc.JDBCExecutor
Initial separation of DBObjects from the underlying JDBC code that gets executed. This is part number 1 where we move a lot of the JDBC code over to this helper class. For round #1 iteration, we're assuming that the valueObject is actually a DBObject that implements the DataObject interface (which it does). This is because we're interested in getting something working and demonstratable, and then slowly flesh out the DataObject interface so that we can eventually completely prune this class completely away from the DBObject class and work strictly with the DataObject Interface.
| Constructor Summary | |
JDBCExecutor()
|
|
| Method Summary | |
void |
add(DataObject valueObject)
Takes a DataObject and adds it to the underlying data source |
void |
addBatch(List valueObjectList)
Adds an entire batch of DataObjects to the underlying JDBC data source |
protected String |
buildPreparedAddSQL(DataObject oneObjectType)
Helper Function to build a prepared statement's SQL for an ADD statement. |
protected String |
buildPreparedUpdateSQL(DataObject oneObjectType)
Helper function to build a prepared update statement for batch updates. |
void |
delete(DataObject valueObject)
Takes a DataObject and deletes it from the underlying data source.
|
protected String |
prepareForStorage(DataFieldMetaData oneField,
DBObject theObj)
Format the field for storage into a prepared statement. |
boolean |
retrieve(DataObject valueObject)
Retrieves the object with keys specified by the valueObject parameter. |
void |
update(DataObject valueObject,
boolean updateChangedFieldsOnly)
Takes a DataObject and updates it to the underlying data source |
void |
updateBatch(List valueObjectList)
Updates an entire batch of DataObjects |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public JDBCExecutor()
| Method Detail |
public void add(DataObject valueObject)
throws DataException,
DuplicateKeyException
DataObject and adds it to the underlying data source
add in interface DataExecutorInterfacevalueObject - the DataObject to add.
DataException - upon error adding the object to the data source
DuplicateKeyException - if the object already existed in the data
source.
public void delete(DataObject valueObject)
throws DataException
DataObject and deletes it from the underlying data source.
Note: The current implementation only expects a DBObject
and actually routes the call back to that object. Will be fixed in the future
as the interface becomes more rich.
delete in interface DataExecutorInterfacevalueObject - the DataObject to delete.
DataException - upon error deleting the object to the data source
public void update(DataObject valueObject,
boolean updateChangedFieldsOnly)
throws DataException
DataObject and updates it to the underlying data source
update in interface DataExecutorInterfacevalueObject - the DataObject to update.updateChangedFieldsOnly - if true only modified fields (isChanged = true)
will be included in the update
DataException - upon error updating the object to the data source
public boolean retrieve(DataObject valueObject)
throws DataException
DBObject's retrieve method.
retrieve in interface DataExecutorInterfacevalueObject - the DataObject who's keys are already set to retrieve
DataException
public void addBatch(List valueObjectList)
throws DataException,
DuplicateKeyException
DataObjects to the underlying JDBC data source
addBatch in interface DataExecutorInterfacevalueObjectList - A list of DataObjects to add to the underlying
data source NOTE: you will get best performance if valueObjectList is
all one dataobject underneath.
WARNING: I DON'T UNDERSTAND WHY LOOP VAR ISN'T USED BELOW, AND SUSPECT THIS METHOD ISN'T DOING ALL IT PURPORTS TO DO; SEE "todo" (Larry Hamel, 3/03)
DataException - upon error communicating with the underlying data source
DuplicateKeyException - if one of the records was already in the
data source
public void updateBatch(List valueObjectList)
throws DataException
DataObjects
updateBatch in interface DataExecutorInterfacevalueObjectList - A list of DataObjects to update to the underlying
data source
DataException - upon error updating the data source
protected String buildPreparedUpdateSQL(DataObject oneObjectType)
throws DBException
oneObjectType - A single DataObject that is used to model the prepared
statement. Only metadata about the DataObject is used.
FastStringBuffer containing the proper SQL to create
a preparedStatement
DBException - upon error
protected String buildPreparedAddSQL(DataObject oneObjectType)
throws DBException
oneObjectType - A single DataObject that is used to model the prepared
statement. Only metadata about the DataObject is used.
DBException - upon error
protected String prepareForStorage(DataFieldMetaData oneField,
DBObject theObj)
throws DBException
DBObject.quoteIfNeeded() but it does not insert
quotes around the values since the prepared statements will take care
of special characters like that
oneField - The metadata of the field to retrievetheObj - The DBObject that contains the data to store.
DBException
|
Expresso 5-5-0 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||