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
public class StatementQueryMechanism extends CallQueryMechanism
Purpose: Mechanism used for all statement objects.
Responsibilities: Executes the appropriate statement.
- Since:
- TOPLink/Java 1.0
- Author:
- Yvon Lavoie
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected SQLStatementsqlStatementprotected VectorsqlStatementsNormally 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
Constructors Constructor Description StatementQueryMechanism()StatementQueryMechanism(DatabaseQuery query)INTERNAL: Return a new mechanism for the queryStatementQueryMechanism(DatabaseQuery query, SQLStatement statement)Return a new mechanism for the query
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearStatement()The statement is no longer require after prepare so can be released.DatabaseQueryMechanismclone(DatabaseQuery queryClone)Clone the mechanism for the specified query clone.protected voidconfigureDatabaseCall(DatabaseCall call)Set the call level query options into the call.IntegerdeleteObject()INTERNAL: delete the objectObjectexecuteNoSelect()Update the objectExpressiongetSelectionCriteria()Return the selection criteria for the statement.SQLStatementgetSQLStatement()INTERNAL: Return the sqlStatementVectorgetSQLStatements()Normally only a single statement is used, however multiple table may require multiple statements on write.booleanhasMultipleStatements()Normally only a single statement is used, however multiple table may require multiple statements on write.voidinsertObject()Insert the objectvoidinsertObject(boolean reprepare)Insert the object if the reprepare flag is set, first reprepare the query.booleanisCallQueryMechanism()Return true if this is a call query mechanismbooleanisStatementQueryMechanism()Return true if this is a statement query mechanismvoidprepare()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.voidprepareCursorSelectAllRows()Pre-build the SQL call from the statement.voidprepareDeleteAll()Pre-build the SQL call from the statement.voidprepareDeleteObject()Pre-build the SQL call from the statement.voidprepareDoesExist(DatabaseField field)Pre-build the SQL call from the statement.voidprepareExecuteNoSelect()Pre-build the SQL call from the statement.voidprepareExecuteSelect()Pre-build the SQL call from the statement.voidprepareInsertObject()Pre-build the SQL call from the statement.voidprepareSelectAllRows()Pre-build the SQL call from the statement.voidprepareSelectOneRow()Pre-build the SQL call from the statement.voidprepareUpdateAll()Pre-build the SQL call from the statement.voidprepareUpdateObject()Pre-build the SQL call from the statement.protected voidsetCallFromStatement()Pre-build the SQL call from the statement.voidsetSQLStatement(SQLStatement statement)Set the sqlStatementprotected voidsetSQLStatements(Vector sqlStatements)Normally only a single statement is used, however multiple table may require multiple statements on write.voidtrimFieldsForInsert()INTERNAL Remove a potential sequence number field and invoke the ReturningPolicy trimModifyRowsForInsert methodIntegerupdateObject()Update the object-
Methods 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 Detail
-
sqlStatement
protected SQLStatement sqlStatement
-
sqlStatements
protected Vector sqlStatements
Normally only a single statement is used, however multiple table may require multiple statements on write.
-
-
Constructor Detail
-
StatementQueryMechanism
public StatementQueryMechanism()
-
StatementQueryMechanism
public StatementQueryMechanism(DatabaseQuery query)
INTERNAL: Return a new mechanism for the query- Parameters:
query- - owner of mechanism
-
StatementQueryMechanism
public StatementQueryMechanism(DatabaseQuery query, SQLStatement statement)
Return a new mechanism for the query- Parameters:
query- - owner of mechanismstatement- - sql statement
-
-
Method Detail
-
clearStatement
public void clearStatement()
The statement is no longer require after prepare so can be released.
-
clone
public DatabaseQueryMechanism clone(DatabaseQuery queryClone)
Clone the mechanism for the specified query clone.- Overrides:
clonein classDatasourceCallQueryMechanism
-
configureDatabaseCall
protected void configureDatabaseCall(DatabaseCall call)
Description copied from class:CallQueryMechanismSet the call level query options into the call.- Overrides:
configureDatabaseCallin classCallQueryMechanism
-
deleteObject
public Integer deleteObject() throws DatabaseException
INTERNAL: delete the object- Overrides:
deleteObjectin classDatasourceCallQueryMechanism- Returns:
- the row count.
- Throws:
DatabaseException- - an error has occurred on the database.
-
executeNoSelect
public Object executeNoSelect() throws DatabaseException
Update the object- Overrides:
executeNoSelectin classDatasourceCallQueryMechanism- Returns:
- the row count.
- Throws:
DatabaseException- - an error has occurred on the database.
-
getSelectionCriteria
public Expression getSelectionCriteria()
Return the selection criteria for the statement.- Overrides:
getSelectionCriteriain classDatabaseQueryMechanism
-
getSQLStatement
public SQLStatement getSQLStatement()
INTERNAL: Return the sqlStatement
-
getSQLStatements
public Vector 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
public void insertObject() throws DatabaseExceptionInsert the object- Overrides:
insertObjectin 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:
insertObjectin 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:
isCallQueryMechanismin classDatasourceCallQueryMechanism
-
isStatementQueryMechanism
public boolean isStatementQueryMechanism()
Return true if this is a statement query mechanism- Overrides:
isStatementQueryMechanismin 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:
preparein classDatasourceCallQueryMechanism
-
prepareCursorSelectAllRows
public void prepareCursorSelectAllRows()
Pre-build the SQL call from the statement.- Overrides:
prepareCursorSelectAllRowsin classCallQueryMechanism
-
prepareDeleteAll
public void prepareDeleteAll()
Pre-build the SQL call from the statement.- Overrides:
prepareDeleteAllin classCallQueryMechanism
-
prepareDeleteObject
public void prepareDeleteObject()
Pre-build the SQL call from the statement.- Overrides:
prepareDeleteObjectin classCallQueryMechanism
-
prepareDoesExist
public void prepareDoesExist(DatabaseField field)
Pre-build the SQL call from the statement.- Overrides:
prepareDoesExistin classCallQueryMechanism
-
prepareExecuteNoSelect
public void prepareExecuteNoSelect()
Pre-build the SQL call from the statement.- Overrides:
prepareExecuteNoSelectin classDatasourceCallQueryMechanism
-
prepareExecuteSelect
public void prepareExecuteSelect()
Pre-build the SQL call from the statement.- Overrides:
prepareExecuteSelectin classCallQueryMechanism
-
prepareInsertObject
public void prepareInsertObject()
Pre-build the SQL call from the statement.- Overrides:
prepareInsertObjectin classDatasourceCallQueryMechanism
-
prepareSelectAllRows
public void prepareSelectAllRows()
Pre-build the SQL call from the statement.- Overrides:
prepareSelectAllRowsin classCallQueryMechanism
-
prepareSelectOneRow
public void prepareSelectOneRow()
Pre-build the SQL call from the statement.- Overrides:
prepareSelectOneRowin classCallQueryMechanism
-
prepareUpdateObject
public void prepareUpdateObject()
Pre-build the SQL call from the statement.- Overrides:
prepareUpdateObjectin classCallQueryMechanism
-
prepareUpdateAll
public void prepareUpdateAll()
Pre-build the SQL call from the statement.- Overrides:
prepareUpdateAllin classDatasourceCallQueryMechanism
-
setCallFromStatement
protected void setCallFromStatement()
Pre-build the SQL call from the statement.
-
setSQLStatement
public void setSQLStatement(SQLStatement statement)
Set the sqlStatement
-
setSQLStatements
protected void setSQLStatements(Vector sqlStatements)
Normally only a single statement is used, however multiple table may require multiple statements on write. This is lazy initialized to conserve space.
-
updateObject
public Integer updateObject() throws DatabaseException
Update the object- Overrides:
updateObjectin classDatasourceCallQueryMechanism- Returns:
- the row count.
- Throws:
DatabaseException- - an error has occurred on the database.
-
-