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.
author: Michael Rimov author: Yves Henri AMAIZO since: Expresso 5.0
buildPreparedAddSQL(DataObject oneObjectType, boolean addChangedFieldsOnly) Helper Function to build a prepared statement's SQL for an ADD statement.
Parameters: oneObjectType - A single DataObject that is used to model the preparedstatement.
buildPreparedDeleteSQL(DataObject oneObjectType, boolean deleteWithSetFieldsOnly) Helper function to build a prepared delete statement for batch deletes.
Parameters: oneObjectType - A single DataObject that is used to model the preparedstatement.
buildPreparedStoreProcedureSQL(DataObject oneObjectType) Helper Function to build a prepared statement's SQL for running STore Procedure statement.
Parameters: oneObjectType - A single DataObject that is used to model the preparedstatement.
buildPreparedUpdateSQL(DataObject oneObjectType, boolean updateChangedFieldsOnly) Helper function to build a prepared update statement for batch updates.
Parameters: oneObjectType - A single DataObject that is used to model the preparedstatement.
delete(DataObject valueObject) Takes a 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.
public void
deleteAll(DataObject valueObject, boolean deleteChangedCache) Takes a 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.
Takes a DataObject and adds it to the underlying data source
Parameters: valueObject - the DataObject to add. throws: DataException - upon error adding the object to the data source throws: DuplicateKeyException - if the object already existed in the datasource.Modify by Yves Henri AMAIZO since: $DatabaseSchema $Date: 2004/11/18 02:03:27 $
Adds an entire batch of DataObjects to the underlying JDBC data source
Parameters: valueObjectList - A list of DataObjects to add to the underlyingdata source NOTE: you will get best performance if valueObjectList isall 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) throws: DataException - upon error communicating with the underlying data source throws: DuplicateKeyException - if one of the records was already in thedata source
Adds an entire batch of DataObjects to the underlying JDBC data source
Parameters: valueObjectList - A list of DataObjects to add to the underlyingdata source NOTE: you will get best performance if valueObjectList isall one dataobject underneath. Parameters: addChangedFieldsOnly - flag to signify if only fields whose valuehas changed should be included in the add.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) throws: DataException - upon error communicating with the underlying data source throws: DuplicateKeyException - if one of the records was already in thedata source
Helper Function to build a prepared statement's SQL for an ADD statement.
Parameters: oneObjectType - A single DataObject that is used to model the preparedstatement. Only metadata about the DataObject is used. Parameters: addChangedFieldsOnly - flag to signify if only fields whose valuehas changed should be included in the add. a FastStringBuffer containing the build sql statement throws: DBException - upon errorModify by Yves Henri AMAIZO since: $DatabaseSchema $Date: 2004/11/18 02:03:27 $
Helper function to build a prepared delete statement for batch deletes.
Parameters: oneObjectType - A single DataObject that is used to model the preparedstatement. Only metadata about the DataObject is used. A FastStringBuffer containing the proper SQL to createa preparedStatement throws: DBException - upon errorModify by Yves Henri AMAIZO since: $DatabaseSchema $Date: 2004/11/18 02:03:27 $
Helper Function to build a prepared statement's SQL for running STore Procedure statement.
Parameters: oneObjectType - A single DataObject that is used to model the preparedstatement. Only metadata about the DataObject is used. a FastStringBuffer containing the build sql statement throws: DBException - upon error
Helper function to build a prepared update statement for batch updates.
Parameters: oneObjectType - A single DataObject that is used to model the preparedstatement. Only metadata about the DataObject is used. Parameters: updateChangedFieldsOnly - true if the changed fields should be theonly ones sent through the SQL query. A FastStringBuffer containing the proper SQL to createa preparedStatement throws: DBException - upon errorModify by Yves Henri AMAIZO since: $DatabaseSchema $Date: 2004/11/18 02:03:27 $
Build and return a FastStringBuffer ring consisting of an SQL 'where' clause
using the current field values as criteria for the search. See
setCustomWhereClause for information on specifying a more complex where clause.
Parameters: criteria - the JDBCDataObject to build from Parameters: myCallableStatement - the statement A FastStringBuffer containing the "where" clause for the SQL statement throws: DataException - upon error
Takes a 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.
Parameters: valueObject - the DataObject to delete. throws: DataException - upon error deleting the object to the data source
Takes a 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.
Parameters: valueObject - the DataObject to delete. throws: DataException - upon error deleting the object to the data source
deleteBatch
public void deleteBatch(List valueObjectList, boolean deleteWithSetFieldsOnly) throws DataException(Code)
Updates an entire batch of DataObjects
Parameters: valueObjectList - A list of DataObjects to update to the underlyingdata source Parameters: deleteWithSetFieldsOnly - Only include changed fields in the update throws: DataException - upon error updating the data source
Deletes an entire batch of DataObjects
Parameters: valueObjectList - A list of DataObjects to delete to the underlyingdata source throws: DataException - upon error deleting the data source
Format the field for storage into a prepared statement. This is similar
to the old DBObject.quoteIfNeeded() but it does not insert
quotes around the values since the prepared statements will take care
of special characters like that
Parameters: oneField - The metadata of the field to retrieve Parameters: theObj - The DBObject that contains the data to store. java.lang.String for the appropriate data value.
Format the field for storage into a prepared statement. This is similar
to the old DBObject.quoteIfNeeded() but it does not insert
quotes around the values since the prepared statements will take care
of special characters like that
Parameters: oneField - The metadata of the field to retrieve Parameters: theObj - The DBObject that contains the data to store. java.lang.String for the appropriate data value.
Retrieves the object with keys specified by the valueObject parameter.
This has the same semantics as DBObject's retrieve method.
Parameters: valueObject - the DataObject who's keys are already set to retrieve true if the data object was successfully retrieved throws: DataException - Modify by Yves Henri AMAIZO since: $DatabaseSchema $Date: 2004/11/18 02:03:27 $
Run a store procedure identify by the object with keys specified by the
valueObject parameter.
Parameters: valueObject - the DataObject who's keys are already set to retrieve true if the data object was successfully retrieved
Takes a DataObject and updates it to the underlying data source
Parameters: valueObject - the DataObject to update. Parameters: updateChangedFieldsOnly - if true only modified fields (isChanged = true)will be included in the update throws: DataException - upon error updating the object to the data sourceModify by Yves Henri AMAIZO since: $DatabaseSchema $Date: 2004/11/18 02:03:27 $
Takes a DataObject and updates all to the underlying data source
Parameters: valueObject - the DataObject to update. Parameters: updateChangedCache - if true only modified fields (isChanged = true)will be included in the update throws: DataException - upon error updating the object to the data sourceModify by Yves Henri AMAIZO since: $DatabaseSchema $Date: 2004/11/18 02:03:27 $
Updates an entire batch of DataObjects
Parameters: valueObjectList - A list of DataObjects to update to the underlyingdata source throws: DataException - upon error updating the data source
updateBatch
public void updateBatch(List valueObjectList, boolean updateChangedFieldsOnly) throws DataException(Code)
Updates an entire batch of DataObjects
Parameters: valueObjectList - A list of DataObjects to update to the underlyingdata source Parameters: updateChangedFieldsOnly - flag to signify if only fields whose valuehas changed should be included in the update. throws: DataException - upon error updating the data source