Class DatasourceCallQueryMechanism
- java.lang.Object
-
- org.eclipse.persistence.internal.queries.DatabaseQueryMechanism
-
- org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
- Direct Known Subclasses:
CallQueryMechanism
public class DatasourceCallQueryMechanism extends DatabaseQueryMechanism
Purpose: Mechanism used for call queries.
Responsibilities: Executes the appropriate call.
- Since:
- OracleAS TopLink 10g (10.0.3)
- Author:
- James Sutherland
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected DatasourceCall
call
protected java.util.Vector
calls
Normally only a single call is used, however multiple table may require multiple calls on write.-
Fields inherited from class org.eclipse.persistence.internal.queries.DatabaseQueryMechanism
query
-
-
Constructor Summary
Constructors Constructor Description DatasourceCallQueryMechanism()
DatasourceCallQueryMechanism(DatabaseQuery query)
Initialize the state of the queryDatasourceCallQueryMechanism(DatabaseQuery query, DatasourceCall call)
Initialize the state of the query
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCall(DatasourceCall call)
Add the call.DatabaseQueryMechanism
clone(DatabaseQuery queryClone)
Clone the DatasourceCall and Vector. protected int
computeAndSetItemOffset(ReportQuery query, java.util.List<ReportItem> items, int itemOffset)
calculate indexes for given items, given the current OffsetDatabaseCall
cursorSelectAllRows()
Read all rows from the database using a cursored stream.java.lang.Integer
deleteAll()
INTERNAL: Delete a collection of objects.java.lang.Integer
deleteAllUsingTempTables()
Execute deleteAll using temp tablesjava.lang.Integer
deleteObject()
INTERNAL: Delete an object.java.lang.Object
execute()
INTERNAL: Execute a call.protected java.lang.Object
executeCall()
Execute the call.protected java.lang.Object
executeCall(DatasourceCall databaseCall)
Execute the call.void
executeDeferredCall(DatasourceCall call)
Execute the call that was deferred to the commit manager.java.lang.Object
executeNoSelect()
Execute a non selecting call.java.lang.Integer
executeNoSelectCall()
Execute a non selecting call.java.util.Vector
executeSelect()
INTERNAL: Execute a selecting call.java.util.Vector
executeSelectCall()
INTERNAL: Execute a selecting call.DatabaseCall
generateKeysExecuteNoSelect()
Execute a non selecting call.DatasourceCall
getCall()
Return the call.java.util.Vector
getCalls()
Normally only a single call is used, however multiple table may require multiple calls on write.boolean
hasMultipleCalls()
Normally only a single call is used, however multiple table may require multiple calls on write.void
insertObject()
Insert the object.boolean
isCallQueryMechanism()
Return true if this is a call query mechanismvoid
prepare()
INTERNAL: This is different from 'prepareForExecution' in that this is called on the original query, and the other is called on the copy of the query.void
prepareCall()
INTERNAL: This is different from 'prepareForExecution' in that this is called on the original query, and the other is called on the copy of the query.void
prepareCursorSelectAllRows()
Pre-build configure the call.void
prepareDeleteAll()
Pre-build configure the call.void
prepareDeleteObject()
Pre-build configure the call.void
prepareDoesExist(DatabaseField field)
Pre-build configure the call.void
prepareExecute()
Pre-build configure the call.void
prepareExecuteNoSelect()
Pre-build configure the call.void
prepareExecuteSelect()
Pre-build configure the call.void
prepareInsertObject()
Pre-build configure the call.protected void
prepareReportQueryItems()
Prepare the report items.void
prepareReportQuerySelectAllRows()
Pre-build configure the call.void
prepareReportQuerySubSelect()
Prepare for a sub select using a call.void
prepareSelectAllRows()
Pre-build configure the call.void
prepareSelectOneRow()
Pre-build configure the call.void
prepareUpdateAll()
Pre-build configure the call.void
prepareUpdateObject()
Pre-build configure the call.java.util.Vector
selectAllReportQueryRows()
Read all rows from the database.java.util.Vector
selectAllRows()
Read all rows from the database.AbstractRecord
selectOneRow()
Read a single row from the database.DatabaseCall
selectResultSet()
Read all rows from the database, return ResultSetAbstractRecord
selectRowForDoesExist(DatabaseField field)
Perform a does exist checkvoid
setCall(DatasourceCall call)
Set the call.protected void
setCalls(java.util.Vector calls)
Normally only a single call is used, however multiple table may require multiple calls on write.java.lang.Integer
updateAll()
Update the rows on the database.java.lang.Integer
updateAllUsingTempTables()
Execute updateAll using temp tablesprotected void
updateForeignKeyFieldAfterInsert(WriteObjectQuery writeQuery)
Update the foreign key fields when resolving a bi-directional reference in a UOW.java.lang.Integer
updateObject()
Update the object.-
Methods inherited from class org.eclipse.persistence.internal.queries.DatabaseQueryMechanism
addWriteLockFieldForInsert, buildSelectionCriteria, checkCacheForObject, clone, executeWrite, executeWriteWithChangeSet, getDescriptor, getExecutionSession, getModifyRow, getQuery, getReadObjectQuery, getSelectionCriteria, getSession, getTranslationRow, getWriteObjectQuery, insertObject, insertObjectForWrite, isExpressionQueryMechanism, isJPQLCallQueryMechanism, isQueryByExampleMechanism, isStatementQueryMechanism, performUserDefinedInsert, performUserDefinedUpdate, performUserDefinedWrite, registerObjectInIdentityMap, setQuery, shallowInsertObjectForWrite, unprepare, updateForeignKeyFieldAfterInsert, updateForeignKeyFieldBeforeDelete, updateObjectAndRowWithReturnRow, updateObjectAndRowWithSequenceNumber, updateObjectAndRowWithSequenceNumber, updateObjectForWrite, updateObjectForWriteWithChangeSet
-
-
-
-
Field Detail
-
call
protected DatasourceCall call
-
calls
protected java.util.Vector calls
Normally only a single call is used, however multiple table may require multiple calls on write.
-
-
Constructor Detail
-
DatasourceCallQueryMechanism
public DatasourceCallQueryMechanism()
-
DatasourceCallQueryMechanism
public DatasourceCallQueryMechanism(DatabaseQuery query)
Initialize the state of the query- Parameters:
query
- - owner of mechanism
-
DatasourceCallQueryMechanism
public DatasourceCallQueryMechanism(DatabaseQuery query, DatasourceCall call)
Initialize the state of the query- Parameters:
query
- - owner of mechanism
-
-
Method Detail
-
addCall
public void addCall(DatasourceCall call)
Add the call.
-
clone
public DatabaseQueryMechanism clone(DatabaseQuery queryClone)
Clone the DatasourceCall and Vector. - Overrides:
clone
in classDatabaseQueryMechanism
-
cursorSelectAllRows
public DatabaseCall cursorSelectAllRows() throws DatabaseException
Read all rows from the database using a cursored stream.- Specified by:
cursorSelectAllRows
in classDatabaseQueryMechanism
- Throws:
DatabaseException
- - an error has occurred on the database
-
selectResultSet
public DatabaseCall selectResultSet() throws DatabaseException
Read all rows from the database, return ResultSet- Throws:
DatabaseException
- - an error has occurred on the database
-
deleteAll
public java.lang.Integer deleteAll() throws DatabaseException
INTERNAL: Delete a collection of objects. Assume call is correct.- Specified by:
deleteAll
in classDatabaseQueryMechanism
- Throws:
DatabaseException
- - an error has occurred on the database
-
deleteAllUsingTempTables
public java.lang.Integer deleteAllUsingTempTables() throws DatabaseException
Execute deleteAll using temp tables- Returns:
- the row count.
- Throws:
DatabaseException
- - an error has occurred on the database.
-
deleteObject
public java.lang.Integer deleteObject() throws DatabaseException
INTERNAL: Delete an object. Assume call is correct- Specified by:
deleteObject
in classDatabaseQueryMechanism
- Returns:
- the row count.
- Throws:
DatabaseException
- - an error has occurred on the database
-
execute
public java.lang.Object execute() throws DatabaseException
INTERNAL: Execute a call.- Specified by:
execute
in classDatabaseQueryMechanism
- Returns:
- true if the first result is a result set and false if it is an update count or there are no results other than through INOUT and OUT parameterts, if any.
- Throws:
DatabaseException
- - an error has occurred on the database
-
executeCall
protected java.lang.Object executeCall() throws DatabaseException
Execute the call. It is assumed the call has been fully prepared.- Throws:
DatabaseException
- - an error has occurred on the database.
-
executeCall
protected java.lang.Object executeCall(DatasourceCall databaseCall) throws DatabaseException
Execute the call. It is assumed the call has been fully prepared.- Throws:
DatabaseException
- - an error has occurred on the database.
-
executeNoSelect
public java.lang.Object executeNoSelect() throws DatabaseException
Execute a non selecting call.- Specified by:
executeNoSelect
in classDatabaseQueryMechanism
- Returns:
- Returns either a
DatabaseCall
or Integer value, depending on if this INSERT call needs to return generated keys - Throws:
DatabaseException
- - an error has occurred on the database.
-
generateKeysExecuteNoSelect
public DatabaseCall generateKeysExecuteNoSelect() throws DatabaseException
Execute a non selecting call.- Specified by:
generateKeysExecuteNoSelect
in classDatabaseQueryMechanism
- Returns:
- the row count.
- Throws:
DatabaseException
- - an error has occurred on the database.
-
executeNoSelectCall
public java.lang.Integer executeNoSelectCall() throws DatabaseException
Execute a non selecting call.- Returns:
- the row count.
- Throws:
DatabaseException
- - an error has occurred on the database.
-
executeSelect
public java.util.Vector executeSelect() throws DatabaseException
INTERNAL: Execute a selecting call.- Specified by:
executeSelect
in classDatabaseQueryMechanism
- Throws:
DatabaseException
- - an error has occurred on the database
-
executeSelectCall
public java.util.Vector executeSelectCall() throws DatabaseException
INTERNAL: Execute a selecting call.- Throws:
DatabaseException
- - an error has occurred on the database
-
getCall
public DatasourceCall getCall()
Return the call.
-
getCalls
public java.util.Vector getCalls()
Normally only a single call is used, however multiple table may require multiple calls on write. This is lazy initialised to conserve space.
-
hasMultipleCalls
public boolean hasMultipleCalls()
Normally only a single call is used, however multiple table may require multiple calls on write. This is lazy initialised to conserve space.
-
insertObject
public void insertObject() throws DatabaseException
Insert the object. Assume the call is correct.- Specified by:
insertObject
in classDatabaseQueryMechanism
- Throws:
DatabaseException
- - an error has occurred on the database
-
executeDeferredCall
public void executeDeferredCall(DatasourceCall call)
Execute the call that was deferred to the commit manager. This is used to allow multiple table batching and deadlock avoidance.- Overrides:
executeDeferredCall
in classDatabaseQueryMechanism
-
isCallQueryMechanism
public boolean isCallQueryMechanism()
Return true if this is a call query mechanism- Overrides:
isCallQueryMechanism
in classDatabaseQueryMechanism
-
prepare
public void prepare()
INTERNAL: This is different from 'prepareForExecution' in that this is called on the original query, and the other is called on the copy of the query. This query is copied for concurrency so this prepare can only setup things that will apply to any future execution of this query.- Overrides:
prepare
in classDatabaseQueryMechanism
-
prepareCall
public void prepareCall() throws QueryException
INTERNAL: This is different from 'prepareForExecution' in that this is called on the original query, and the other is called on the copy of the query. This query is copied for concurrency so this prepare can only setup things that will apply to any future execution of this query.- Throws:
QueryException
-
prepareCursorSelectAllRows
public void prepareCursorSelectAllRows() throws QueryException
Pre-build configure the call.- Specified by:
prepareCursorSelectAllRows
in classDatabaseQueryMechanism
- Throws:
QueryException
-
prepareDeleteAll
public void prepareDeleteAll()
Pre-build configure the call.- Specified by:
prepareDeleteAll
in classDatabaseQueryMechanism
-
prepareDeleteObject
public void prepareDeleteObject()
Pre-build configure the call.- Specified by:
prepareDeleteObject
in classDatabaseQueryMechanism
-
prepareDoesExist
public void prepareDoesExist(DatabaseField field)
Pre-build configure the call.- Specified by:
prepareDoesExist
in classDatabaseQueryMechanism
-
prepareExecuteNoSelect
public void prepareExecuteNoSelect()
Pre-build configure the call.- Specified by:
prepareExecuteNoSelect
in classDatabaseQueryMechanism
-
prepareExecute
public void prepareExecute()
Pre-build configure the call. This method assumes the query was built using a stored procedure query which is a single call. The return type on the call will already be set and- Specified by:
prepareExecute
in classDatabaseQueryMechanism
-
prepareExecuteSelect
public void prepareExecuteSelect()
Pre-build configure the call.- Specified by:
prepareExecuteSelect
in classDatabaseQueryMechanism
-
prepareInsertObject
public void prepareInsertObject()
Pre-build configure the call.- Specified by:
prepareInsertObject
in classDatabaseQueryMechanism
-
prepareReportQueryItems
protected void prepareReportQueryItems()
Prepare the report items. Indexes of results need to be calculated.
-
computeAndSetItemOffset
protected int computeAndSetItemOffset(ReportQuery query, java.util.List<ReportItem> items, int itemOffset)
calculate indexes for given items, given the current Offset
-
prepareReportQuerySelectAllRows
public void prepareReportQuerySelectAllRows()
Pre-build configure the call.- Specified by:
prepareReportQuerySelectAllRows
in classDatabaseQueryMechanism
-
prepareReportQuerySubSelect
public void prepareReportQuerySubSelect()
Prepare for a sub select using a call.- Specified by:
prepareReportQuerySubSelect
in classDatabaseQueryMechanism
-
prepareSelectAllRows
public void prepareSelectAllRows()
Pre-build configure the call.- Specified by:
prepareSelectAllRows
in classDatabaseQueryMechanism
-
prepareSelectOneRow
public void prepareSelectOneRow()
Pre-build configure the call.- Specified by:
prepareSelectOneRow
in classDatabaseQueryMechanism
-
prepareUpdateObject
public void prepareUpdateObject()
Pre-build configure the call.- Specified by:
prepareUpdateObject
in classDatabaseQueryMechanism
-
prepareUpdateAll
public void prepareUpdateAll()
Pre-build configure the call.- Specified by:
prepareUpdateAll
in classDatabaseQueryMechanism
-
selectAllReportQueryRows
public java.util.Vector selectAllReportQueryRows() throws DatabaseException
Read all rows from the database. Assume call is correct returns the required fields.- Specified by:
selectAllReportQueryRows
in classDatabaseQueryMechanism
- Returns:
- Vector containing the database rows
- Throws:
DatabaseException
- - an error has occurred on the database
-
selectAllRows
public java.util.Vector selectAllRows() throws DatabaseException
Read all rows from the database. Assume call is correct returns the required fields.- Specified by:
selectAllRows
in classDatabaseQueryMechanism
- Returns:
- Vector containing the database rows
- Throws:
DatabaseException
- - an error has occurred on the database
-
selectOneRow
public AbstractRecord selectOneRow() throws DatabaseException
Read a single row from the database. Assume call is correct.- Specified by:
selectOneRow
in classDatabaseQueryMechanism
- Returns:
- row containing data
- Throws:
DatabaseException
- - an error has occurred on the database
-
selectRowForDoesExist
public AbstractRecord selectRowForDoesExist(DatabaseField field) throws DatabaseException
Perform a does exist check- Specified by:
selectRowForDoesExist
in classDatabaseQueryMechanism
- Parameters:
field
- - the field used for does exist check- Returns:
- the associated row from the database
- Throws:
DatabaseException
- - an error has occurred on the database
-
setCall
public void setCall(DatasourceCall call)
Set the call.
-
setCalls
protected void setCalls(java.util.Vector calls)
Normally only a single call is used, however multiple table may require multiple calls on write. This is lazy initialised to conserve space.
-
updateObject
public java.lang.Integer updateObject() throws DatabaseException
Update the object. Assume the call is correct.- Specified by:
updateObject
in classDatabaseQueryMechanism
- Returns:
- the row count.
- Throws:
DatabaseException
- - an error has occurred on the database.
-
updateAll
public java.lang.Integer updateAll() throws DatabaseException
Update the rows on the database. Assume the call is correct.- Specified by:
updateAll
in classDatabaseQueryMechanism
- Throws:
DatabaseException
- - an error has occurred on the database.
-
updateAllUsingTempTables
public java.lang.Integer updateAllUsingTempTables() throws DatabaseException
Execute updateAll using temp tables- Returns:
- the row count.
- Throws:
DatabaseException
- - an error has occurred on the database.
-
updateForeignKeyFieldAfterInsert
protected void updateForeignKeyFieldAfterInsert(WriteObjectQuery writeQuery)
Update the foreign key fields when resolving a bi-directional reference in a UOW. This is rare to occur for non-relational, however if it does each of the calls must be re-executed.- Specified by:
updateForeignKeyFieldAfterInsert
in classDatabaseQueryMechanism
-
-