Module org.eclipse.persistence.core
Class StatementQueryMechanism
java.lang.Object
org.eclipse.persistence.internal.queries.DatabaseQueryMechanism
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism
org.eclipse.persistence.internal.queries.CallQueryMechanism
org.eclipse.persistence.internal.queries.StatementQueryMechanism
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
ExpressionQueryMechanism
Purpose: Mechanism used for all statement objects.
Responsibilities: Executes the appropriate statement.
- Since:
- TOPLink/Java 1.0
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected SQLStatement
protected Vector
Normally only a single statement is used, however multiple table may require multiple statements on write.Fields inherited from class org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism
call, calls
Fields inherited from class org.eclipse.persistence.internal.queries.DatabaseQueryMechanism
query
-
Constructor Summary
ConstructorDescriptionINTERNAL: Return a new mechanism for the queryStatementQueryMechanism
(DatabaseQuery query, SQLStatement statement) Return a new mechanism for the query -
Method Summary
Modifier and TypeMethodDescriptionvoid
The statement is no longer require after prepare so can be released.clone
(DatabaseQuery queryClone) Clone the mechanism for the specified query clone.protected void
Set the call level query options into the call.INTERNAL: delete the objectUpdate the objectReturn the selection criteria for the statement.INTERNAL: Return the sqlStatementNormally only a single statement is used, however multiple table may require multiple statements on write.boolean
Normally only a single statement is used, however multiple table may require multiple statements on write.void
Insert the objectvoid
insertObject
(boolean reprepare) Insert the object if the reprepare flag is set, first reprepare the query.boolean
Return true if this is a call query mechanismboolean
Return true if this is a statement 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
Pre-build the SQL call from the statement.void
Pre-build the SQL call from the statement.void
Pre-build the SQL call from the statement.void
prepareDoesExist
(DatabaseField field) Pre-build the SQL call from the statement.void
Pre-build the SQL call from the statement.void
Pre-build the SQL call from the statement.void
Pre-build the SQL call from the statement.void
Pre-build the SQL call from the statement.void
Pre-build the SQL call from the statement.void
Pre-build the SQL call from the statement.void
Pre-build the SQL call from the statement.protected void
Pre-build the SQL call from the statement.void
setSQLStatement
(SQLStatement statement) Set the sqlStatementprotected void
setSQLStatements
(Vector sqlStatements) Normally only a single statement is used, however multiple table may require multiple statements on write.void
INTERNAL Remove a potential sequence number field and invoke the ReturningPolicy trimModifyRowsForInsert methodUpdate the objectMethods inherited from class org.eclipse.persistence.internal.queries.CallQueryMechanism
getDatabaseCall, prepareCall, prepareExecute, prepareJoining, setCallHasCustomSQLArguments, unprepare, updateForeignKeyFieldAfterInsert, updateForeignKeyFieldBeforeDelete
Methods inherited from class org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism
addCall, computeAndSetItemOffset, cursorSelectAllRows, deleteAll, deleteAllUsingTempTables, execute, executeCall, executeCall, executeDeferredCall, executeNoSelectCall, executeSelect, executeSelectCall, generateKeysExecuteNoSelect, getCall, getCalls, hasMultipleCalls, prepareReportQueryItems, prepareReportQuerySelectAllRows, prepareReportQuerySubSelect, selectAllReportQueryRows, selectAllRows, selectOneRow, selectResultSet, selectRowForDoesExist, setCall, setCalls, updateAll, updateAllUsingTempTables
Methods inherited from class org.eclipse.persistence.internal.queries.DatabaseQueryMechanism
addWriteLockFieldForInsert, buildSelectionCriteria, checkCacheForObject, clone, executeWrite, executeWriteWithChangeSet, getDescriptor, getExecutionSession, getModifyRow, getQuery, getReadObjectQuery, getSession, getTranslationRow, getWriteObjectQuery, insertObjectForWrite, isExpressionQueryMechanism, isJPQLCallQueryMechanism, isQueryByExampleMechanism, performUserDefinedInsert, performUserDefinedUpdate, performUserDefinedWrite, registerObjectInIdentityMap, setQuery, shallowInsertObjectForWrite, updateForeignKeyFieldAfterInsert, updateObjectAndRowWithReturnRow, updateObjectAndRowWithSequenceNumber, updateObjectAndRowWithSequenceNumber, updateObjectForWrite, updateObjectForWriteWithChangeSet
-
Field Details
-
sqlStatement
-
sqlStatements
Normally only a single statement is used, however multiple table may require multiple statements on write.
-
-
Constructor Details
-
StatementQueryMechanism
public StatementQueryMechanism() -
StatementQueryMechanism
INTERNAL: Return a new mechanism for the query- Parameters:
query
- - owner of mechanism
-
StatementQueryMechanism
Return a new mechanism for the query- Parameters:
query
- - owner of mechanismstatement
- - sql statement
-
-
Method Details
-
clearStatement
public void clearStatement()The statement is no longer require after prepare so can be released. -
clone
Clone the mechanism for the specified query clone.- Overrides:
clone
in classDatasourceCallQueryMechanism
-
configureDatabaseCall
Description copied from class:CallQueryMechanism
Set the call level query options into the call.- Overrides:
configureDatabaseCall
in classCallQueryMechanism
-
deleteObject
INTERNAL: delete the object- Overrides:
deleteObject
in classDatasourceCallQueryMechanism
- Returns:
- the row count.
- Throws:
DatabaseException
- - an error has occurred on the database.
-
executeNoSelect
Update the object- Overrides:
executeNoSelect
in classDatasourceCallQueryMechanism
- Returns:
- the row count.
- Throws:
DatabaseException
- - an error has occurred on the database.
-
getSelectionCriteria
Return the selection criteria for the statement.- Overrides:
getSelectionCriteria
in classDatabaseQueryMechanism
-
getSQLStatement
INTERNAL: Return the sqlStatement -
getSQLStatements
Normally only a single statement is used, however multiple table may require multiple statements on write. This is lazy initialied to conserv space. -
hasMultipleStatements
public boolean hasMultipleStatements()Normally only a single statement is used, however multiple table may require multiple statements on write. This is lazy initialized to conserve space. -
insertObject
Insert the object- Overrides:
insertObject
in classDatasourceCallQueryMechanism
- Throws:
DatabaseException
- - an error has occurred on the database.
-
insertObject
public void insertObject(boolean reprepare) Insert the object if the reprepare flag is set, first reprepare the query. Added for CR#3237- Overrides:
insertObject
in classDatabaseQueryMechanism
- Parameters:
reprepare
- whether to reprepare the query.
-
trimFieldsForInsert
public void trimFieldsForInsert()INTERNAL Remove a potential sequence number field and invoke the ReturningPolicy trimModifyRowsForInsert method -
isCallQueryMechanism
public boolean isCallQueryMechanism()Return true if this is a call query mechanism- Overrides:
isCallQueryMechanism
in classDatasourceCallQueryMechanism
-
isStatementQueryMechanism
public boolean isStatementQueryMechanism()Return true if this is a statement query mechanism- Overrides:
isStatementQueryMechanism
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 classDatasourceCallQueryMechanism
-
prepareCursorSelectAllRows
public void prepareCursorSelectAllRows()Pre-build the SQL call from the statement.- Overrides:
prepareCursorSelectAllRows
in classCallQueryMechanism
-
prepareDeleteAll
public void prepareDeleteAll()Pre-build the SQL call from the statement.- Overrides:
prepareDeleteAll
in classCallQueryMechanism
-
prepareDeleteObject
public void prepareDeleteObject()Pre-build the SQL call from the statement.- Overrides:
prepareDeleteObject
in classCallQueryMechanism
-
prepareDoesExist
Pre-build the SQL call from the statement.- Overrides:
prepareDoesExist
in classCallQueryMechanism
-
prepareExecuteNoSelect
public void prepareExecuteNoSelect()Pre-build the SQL call from the statement.- Overrides:
prepareExecuteNoSelect
in classDatasourceCallQueryMechanism
-
prepareExecuteSelect
public void prepareExecuteSelect()Pre-build the SQL call from the statement.- Overrides:
prepareExecuteSelect
in classCallQueryMechanism
-
prepareInsertObject
public void prepareInsertObject()Pre-build the SQL call from the statement.- Overrides:
prepareInsertObject
in classDatasourceCallQueryMechanism
-
prepareSelectAllRows
public void prepareSelectAllRows()Pre-build the SQL call from the statement.- Overrides:
prepareSelectAllRows
in classCallQueryMechanism
-
prepareSelectOneRow
public void prepareSelectOneRow()Pre-build the SQL call from the statement.- Overrides:
prepareSelectOneRow
in classCallQueryMechanism
-
prepareUpdateObject
public void prepareUpdateObject()Pre-build the SQL call from the statement.- Overrides:
prepareUpdateObject
in classCallQueryMechanism
-
prepareUpdateAll
public void prepareUpdateAll()Pre-build the SQL call from the statement.- Overrides:
prepareUpdateAll
in classDatasourceCallQueryMechanism
-
setCallFromStatement
protected void setCallFromStatement()Pre-build the SQL call from the statement. -
setSQLStatement
Set the sqlStatement -
setSQLStatements
Normally only a single statement is used, however multiple table may require multiple statements on write. This is lazy initialized to conserve space. -
updateObject
Update the object- Overrides:
updateObject
in classDatasourceCallQueryMechanism
- Returns:
- the row count.
- Throws:
DatabaseException
- - an error has occurred on the database.
-