public class UpdateAllQuery extends ModifyAllQuery
Notes:
Example of Usage: Adding an area code.
UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class);
updateQuery.setSelectionCriteria(eb.get("areaCode").isNull());
updateQuery.addUpdate(eb.get("areaCode"), "613");
DatabaseQuery.ParameterType
Modifier and Type | Field and Description |
---|---|
protected java.util.HashMap |
m_updateClauses |
defaultBuilder, INVALIDATE_CACHE, isPreparedUsingTempStorage, NO_CACHE, referenceClass, referenceClassName, result
forceBatchStatementExecution, isBatchExecutionSupported, modifyRow
accessors, allowNativeSQLQuery, argumentFields, argumentParameterTypes, arguments, argumentTypeNames, argumentTypes, argumentValues, BATCH_FETCH_PROPERTY, CascadeAggregateDelete, CascadeAllParts, CascadeByMapping, CascadeDependentParts, cascadePolicy, CascadePrivateParts, descriptor, descriptors, doNotRedirect, executionSession, flushOnExecute, hintString, isCustomQueryUsed, isExecutionClone, isNativeConnectionRequired, isPrepared, isUserDefined, isUserDefinedSQLCall, monitorName, name, NoCascading, nullableArguments, parameterDelimiter, partitioningPolicy, properties, queryMechanism, queryTimeout, queryTimeoutUnit, redirector, session, sessionName, shouldBindAllParameters, shouldCacheStatement, shouldCloneCall, shouldMaintainCache, shouldPrepare, shouldRetrieveBypassCache, shouldStoreBypassCache, shouldUseWrapperPolicy, shouldValidateUpdateCallCacheUse, sourceMapping, translationRow
Constructor and Description |
---|
UpdateAllQuery()
PUBLIC:
Constructs a default update all query.
|
UpdateAllQuery(java.lang.Class referenceClass)
PUBLIC:
Constructs an update all query for the Class type specified.
|
UpdateAllQuery(java.lang.Class referenceClass,
Expression selectionCriteria)
PUBLIC:
Constructs an update all query for the specified Class type and selection criteria.
|
UpdateAllQuery(java.lang.Class referenceClass,
ExpressionBuilder expressionBuilder)
PUBLIC:
Constructs an update all query for the Class type specified and the given
ExpressionBuilder.
|
Modifier and Type | Method and Description |
---|---|
void |
addUpdate(Expression field,
Expression value)
PUBLIC:
Adds the update (SET) clause to the query.
|
void |
addUpdate(Expression field,
java.lang.Object value)
PUBLIC:
Adds the update (SET) clause to the query.
|
void |
addUpdate(java.lang.String attributeName,
Expression value)
PUBLIC:
Adds the update (SET) clause to the query.
|
void |
addUpdate(java.lang.String attributeName,
java.lang.Object value)
PUBLIC:
Adds the update (SET) clause to the query.
|
protected void |
addUpdateInternal(java.lang.Object fieldObject,
java.lang.Object valueObject)
INTERNAL:
|
java.lang.Object |
executeDatabaseQuery()
INTERNAL:
Issue the SQL to the database and then merge into the cache.
|
protected QueryRedirector |
getDefaultRedirector()
INTERNAL:
Returns the specific default redirector for this query type.
|
java.util.HashMap |
getUpdateClauses()
INTERNAL:
Return the updates stored for an update all query
|
protected void |
initializeQuerySpecificDefaultBuilder()
INTERNAL:
Initialize the expression builder which should be used for this query.
|
boolean |
isUpdateAllQuery()
INTERNAL:
Return true if this is an update all query.
|
protected void |
prepare()
INTERNAL:
|
clonedQueryExecutionComplete, executeInUnitOfWork, getCacheUsage, getExpressionBuilder, getReferenceClass, getReferenceClassName, initializeDefaultBuilder, invalidateCache, isModifyAllQuery, isPreparedUsingTempStorage, mergeChangesIntoSharedCache, setCacheUsage, setExpressionBuilder, setIsPreparedUsingTempStorage, setReferenceClass, setReferenceClassName, setShouldDeferExecutionInUOW, shouldDeferExecutionInUOW, shouldInvalidateCache
forceBatchStatementExecution, getModifyRow, isBatchExecutionSupported, isModifyQuery, setForceBatchStatementExecution, setIsBatchExecutionSupported, setModifyRow
addArgument, addArgument, addArgument, addArgument, addArgument, addArgument, addArgumentByTypeName, addArgumentValue, addArgumentValues, addCall, addStatement, bindAllParameters, buildArgumentFields, buildSelectionCriteria, cacheStatement, cascadeAllParts, cascadeByMapping, cascadeOnlyDependentParts, cascadePrivateParts, checkDescriptor, checkEarlyReturn, checkForCustomQuery, checkPrepare, checkPrepare, clone, convertClassNamesToClasses, copyFromQuery, dontBindAllParameters, dontCacheStatement, dontCascadeParts, dontMaintainCache, execute, extractRemoteResult, getAccessor, getAccessors, getArgumentParameterTypes, getArguments, getArgumentTypeNames, getArgumentTypes, getArgumentValues, getBatchObjects, getCall, getCascadePolicy, getDatasourceCall, getDatasourceCalls, getDescriptor, getDescriptors, getDomainClassNounName, getDoNotRedirect, getEJBQLString, getExecutionSession, getFlushOnExecute, getHintString, getJPQLString, getMonitorName, getName, getNullableArguments, getParameterDelimiter, getParameterDelimiterChar, getPartitioningPolicy, getProperties, getProperty, getQueryMechanism, getQueryNounName, getQueryTimeout, getQueryTimeoutUnit, getRedirector, getRedirectorForQuery, getSelectionCriteria, getSensorName, getSession, getSessionName, getShouldBindAllParameters, getSourceMapping, getSQLStatement, getSQLString, getSQLStrings, getTranslatedSQLString, getTranslatedSQLStrings, getTranslationRow, hasAccessor, hasArguments, hasNullableArguments, hasProperties, hasQueryMechanism, hasSessionName, ignoreBindAllParameters, ignoreCacheStatement, isCallQuery, isCascadeOfAggregateDelete, isCustomQueryUsed, isCustomSelectionQuery, isDataModifyQuery, isDataReadQuery, isDefaultPropertiesQuery, isDeleteAllQuery, isDeleteObjectQuery, isDirectReadQuery, isExecutionClone, isExpressionQuery, isInsertObjectQuery, isJPQLCallQuery, isNativeConnectionRequired, isObjectBuildingQuery, isObjectLevelModifyQuery, isObjectLevelReadQuery, isPrepared, isReadAllQuery, isReadObjectQuery, isReadQuery, isReportQuery, isResultSetMappingQuery, isSQLCallQuery, isUpdateObjectQuery, isUserDefined, isUserDefinedSQLCall, isValueReadQuery, isWriteObjectQuery, maintainCache, prepareCall, prepareCustomQuery, prepareForExecution, prepareForRemoteExecution, prepareFromQuery, prepareInternal, redirectQuery, remoteExecute, remoteExecute, removeProperty, replaceValueHoldersIn, resetMonitorName, retrieveBypassCache, rowFromArguments, setAccessor, setAccessors, setAllowNativeSQLQuery, setArguments, setArgumentTypeNames, setArgumentTypes, setArgumentValues, setBatchObjects, setCall, setCascadePolicy, setDatasourceCall, setDescriptor, setDoNotRedirect, setEJBQLString, setExecutionSession, setFlushOnExecute, setHintString, setIsCustomQueryUsed, setIsExecutionClone, setIsNativeConnectionRequired, setIsPrepared, setIsUserDefined, setIsUserDefinedSQLCall, setJPQLString, setName, setNullableArguments, setParameterDelimiter, setPartitioningPolicy, setProperties, setProperty, setQueryMechanism, setQueryTimeout, setQueryTimeoutUnit, setRedirector, setSelectionCriteria, setSession, setSessionName, setShouldBindAllParameters, setShouldBindAllParameters, setShouldCacheStatement, setShouldMaintainCache, setShouldPrepare, setShouldRetrieveBypassCache, setShouldStoreBypassCache, setShouldUseWrapperPolicy, setShouldValidateUpdateCallCacheUse, setSourceMapping, setSQLStatement, setSQLString, setTranslationRow, shouldAllowNativeSQLQuery, shouldBindAllParameters, shouldCacheStatement, shouldCascadeAllParts, shouldCascadeByMapping, shouldCascadeOnlyDependentParts, shouldCascadeParts, shouldCascadePrivateParts, shouldCloneCall, shouldIgnoreBindAllParameters, shouldIgnoreCacheStatement, shouldMaintainCache, shouldPrepare, shouldPrepare, shouldRetrieveBypassCache, shouldStoreBypassCache, shouldUseWrapperPolicy, shouldValidateUpdateCallCacheUse, storeBypassCache, toString
public UpdateAllQuery()
public UpdateAllQuery(java.lang.Class referenceClass)
referenceClass
- Classpublic UpdateAllQuery(java.lang.Class referenceClass, Expression selectionCriteria)
referenceClass
- Class type to be consideredselectionCriteria
- Expressionpublic UpdateAllQuery(java.lang.Class referenceClass, ExpressionBuilder expressionBuilder)
referenceClass
- Class type to be consideredexpressionBuilder
- ExpressionBuilderpublic void addUpdate(Expression field, java.lang.Object value)
field
- Expression Object level representation of a database query 'where' clausevalue
- Object, the new valuepublic void addUpdate(java.lang.String attributeName, java.lang.Object value)
attributeName
- String, the name of the attributevalue
- Object, the new valuepublic void addUpdate(Expression field, Expression value)
field
- Expression, representation of a database query 'where' clause that describes the fieldvalue
- Expression, representation of a database query 'where' clause that describes the new valuepublic void addUpdate(java.lang.String attributeName, Expression value)
attributeName
- String, the name of the attributevalue
- Expression, the new valueprotected void addUpdateInternal(java.lang.Object fieldObject, java.lang.Object valueObject)
public java.lang.Object executeDatabaseQuery() throws DatabaseException
executeDatabaseQuery
in class DatabaseQuery
DatabaseException
- - an error has occurred on the database.protected QueryRedirector getDefaultRedirector()
getDefaultRedirector
in class DatabaseQuery
public java.util.HashMap getUpdateClauses()
public boolean isUpdateAllQuery()
isUpdateAllQuery
in class DatabaseQuery
protected void prepare() throws QueryException
prepare
in class DatabaseQuery
QueryException
protected void initializeQuerySpecificDefaultBuilder()
initializeQuerySpecificDefaultBuilder
in class ModifyAllQuery