public abstract class DatabaseQueryMechanism
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Purpose: Abstract class for all database query mechanism objects. DatabaseQueryMechanism is actually a helper class and currently is required for all types of queries. Most of the work performed by the query framework is performed in the query mechanism. The query mechanism contains the internal knowledge necessary to perform the specific database operation.
Responsibilities: Provide a common protocol for query mechanism objects. Provides all of the database specific work for the assigned query.
Constructor and Description |
---|
DatabaseQueryMechanism()
Initialize the state of the query.
|
DatabaseQueryMechanism(DatabaseQuery query)
Initialize the state of the query
|
Modifier and Type | Method and Description |
---|---|
void |
buildSelectionCriteria(AbstractSession session)
Internal:
In the case of EJBQL, an expression needs to be generated.
|
java.lang.Object |
checkCacheForObject(AbstractRecord translationRow,
AbstractSession session)
Perform a cache lookup for the query.
|
java.lang.Object |
clone()
Clone the mechanism
|
DatabaseQueryMechanism |
clone(DatabaseQuery queryClone)
Clone the mechanism for the specified query clone.
|
abstract DatabaseCall |
cursorSelectAllRows()
Read all rows from the database using a cursored stream.
|
abstract java.lang.Integer |
deleteAll() |
abstract java.lang.Integer |
deleteObject()
Delete an object
This should be overridden by subclasses.
|
abstract java.lang.Object |
execute()
Execute a execute SQL call.
|
void |
executeDeferredCall(DatasourceCall call)
Execute the call that was deferred to the commit manager.
|
abstract java.lang.Integer |
executeNoSelect()
Execute a non selecting SQL call
This should be overridden by subclasses.
|
abstract java.util.Vector |
executeSelect()
Execute a select SQL call and return the rows.
|
java.lang.Object |
executeWrite()
Check whether the object already exists on the database; then
perform an insert or update, as appropriate.
|
java.lang.Object |
executeWriteWithChangeSet()
Check whether the object already exists on the cadatabase; then
perform an insert or update, as appropriate.
|
AbstractRecord |
getModifyRow()
Convenience method
|
DatabaseQuery |
getQuery()
Return the query that uses the mechanism.
|
Expression |
getSelectionCriteria()
Return the selection criteria for the mechanism.
|
abstract void |
insertObject()
Insert an object.
|
void |
insertObject(boolean reprepare)
Insert an object and provide the opportunity to reprepare prior to the insert.
|
void |
insertObjectForWrite()
Insert an object in the database.
|
boolean |
isCallQueryMechanism()
Return true if this is a call query mechanism
|
boolean |
isExpressionQueryMechanism()
Return true if this is an expression query mechanism
|
boolean |
isJPQLCallQueryMechanism()
Delete a collection of objects
This should be overridden by subclasses.
|
boolean |
isQueryByExampleMechanism()
Return true if this is a query by example mechanism
|
boolean |
isStatementQueryMechanism()
Return true if this is a statement query mechanism
|
void |
prepare()
This is different from 'prepareForExecution()'
in that this is called on the original query,
and the other is called on the clone of the query.
|
abstract void |
prepareCursorSelectAllRows()
Pre-pare for a cursored execute.
|
abstract void |
prepareDeleteAll()
Prepare for a delete all.
|
abstract void |
prepareDeleteObject()
Prepare for a delete.
|
abstract void |
prepareDoesExist(DatabaseField field)
Pre-pare for a select execute.
|
abstract void |
prepareExecute()
Prepare for a raw execute call.
|
abstract void |
prepareExecuteNoSelect()
Prepare for a raw (non-object), non-selecting call.
|
abstract void |
prepareExecuteSelect()
Prepare for a raw (non-object) select call.
|
abstract void |
prepareInsertObject()
Prepare for an insert.
|
abstract void |
prepareReportQuerySelectAllRows()
Pre-pare for a select execute.
|
abstract void |
prepareReportQuerySubSelect()
Pre-pare a report query for a sub-select.
|
abstract void |
prepareSelectAllRows()
Prepare for a select returning (possibly) multiple rows.
|
abstract void |
prepareSelectOneRow()
Prepare for a select returning a single row.
|
abstract void |
prepareUpdateAll()
Prepare for an update all.
|
abstract void |
prepareUpdateObject()
Prepare for an update.
|
abstract java.util.Vector |
selectAllReportQueryRows()
INTERNAL:
Read all rows from the database.
|
abstract java.util.Vector |
selectAllRows()
Read and return rows from the database.
|
abstract AbstractRecord |
selectOneRow()
Read and return a row from the database.
|
abstract AbstractRecord |
selectRowForDoesExist(DatabaseField field)
Read and return a row from the database for an existence check.
|
void |
setQuery(DatabaseQuery query)
Set the query that uses this mechanism.
|
void |
unprepare()
Unprepare the call if required.
|
abstract java.lang.Integer |
updateAll()
Issue update SQL statement
|
void |
updateForeignKeyFieldBeforeDelete()
Update the foreign key fields to null when resolving a deletion cycle.
|
abstract java.lang.Integer |
updateObject()
Update an object.
|
void |
updateObjectForWrite()
Update the object.
|
void |
updateObjectForWriteWithChangeSet()
Update the object.
|
public DatabaseQueryMechanism()
public DatabaseQueryMechanism(DatabaseQuery query)
query
- - owner of mechanismpublic void buildSelectionCriteria(AbstractSession session)
public java.lang.Object checkCacheForObject(AbstractRecord translationRow, AbstractSession session)
public java.lang.Object clone()
clone
in class java.lang.Object
public DatabaseQueryMechanism clone(DatabaseQuery queryClone)
public abstract DatabaseCall cursorSelectAllRows() throws DatabaseException
DatabaseException
- - an error has occurred on the databasepublic boolean isJPQLCallQueryMechanism()
DatabaseException
- - an error has occurred on the databasepublic abstract java.lang.Integer deleteAll() throws DatabaseException
DatabaseException
public abstract java.lang.Integer deleteObject() throws DatabaseException
DatabaseException
public abstract java.lang.Object execute() throws DatabaseException
DatabaseException
public abstract java.lang.Integer executeNoSelect() throws DatabaseException
DatabaseException
public abstract java.util.Vector executeSelect() throws DatabaseException
DatabaseException
public java.lang.Object executeWrite() throws DatabaseException, OptimisticLockException
public void executeDeferredCall(DatasourceCall call)
public java.lang.Object executeWriteWithChangeSet() throws DatabaseException, OptimisticLockException
public AbstractRecord getModifyRow()
public DatabaseQuery getQuery()
public Expression getSelectionCriteria()
public abstract void insertObject() throws DatabaseException
DatabaseException
public void insertObject(boolean reprepare)
public void insertObjectForWrite()
public boolean isCallQueryMechanism()
public boolean isExpressionQueryMechanism()
public boolean isQueryByExampleMechanism()
public boolean isStatementQueryMechanism()
public void prepare() throws QueryException
QueryException
public abstract void prepareCursorSelectAllRows() throws QueryException
QueryException
public abstract void prepareDeleteAll() throws QueryException
QueryException
public abstract void prepareDeleteObject() throws QueryException
QueryException
public abstract void prepareDoesExist(DatabaseField field) throws QueryException
QueryException
public abstract void prepareExecuteNoSelect() throws QueryException
QueryException
public abstract void prepareExecute() throws QueryException
QueryException
public abstract void prepareExecuteSelect() throws QueryException
QueryException
public abstract void prepareInsertObject() throws QueryException
QueryException
public abstract void prepareReportQuerySelectAllRows() throws QueryException
QueryException
public abstract void prepareReportQuerySubSelect() throws QueryException
QueryException
public abstract void prepareSelectAllRows() throws QueryException
QueryException
public abstract void prepareSelectOneRow() throws QueryException
QueryException
public abstract void prepareUpdateObject() throws QueryException
QueryException
public abstract void prepareUpdateAll() throws QueryException
QueryException
public abstract java.util.Vector selectAllReportQueryRows() throws DatabaseException
DatabaseException
public abstract java.util.Vector selectAllRows() throws DatabaseException
DatabaseException
public abstract AbstractRecord selectOneRow() throws DatabaseException
DatabaseException
public abstract AbstractRecord selectRowForDoesExist(DatabaseField field) throws DatabaseException
DatabaseException
public void setQuery(DatabaseQuery query)
public abstract java.lang.Integer updateAll() throws DatabaseException
DatabaseException
public abstract java.lang.Integer updateObject() throws DatabaseException
DatabaseException
public void updateForeignKeyFieldBeforeDelete()
public void updateObjectForWrite()
public void updateObjectForWriteWithChangeSet()
public void unprepare()
EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference