Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

B32476-03

oracle.toplink.queryframework
Class UpdateAllQuery

java.lang.Object
  extended by oracle.toplink.queryframework.DatabaseQuery
      extended by oracle.toplink.queryframework.ModifyQuery
          extended by oracle.toplink.queryframework.ModifyAllQuery
              extended by oracle.toplink.queryframework.UpdateAllQuery
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, oracle.toplink.internal.helper.FalseUndefinedTrue

public class UpdateAllQuery
extends ModifyAllQuery

A Query Class used to perform a bulk update using TopLink's expression framework. This class is provided to help optimize performance. It can be used in place of reading in all the objects to be changed and issuing single updates per instance. With this approach a single SQL UPDATE statement can be issued and then, based on the Expression provided, any objects in the cache that are effected by the update can be invalidated.

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");

See Also:
Serialized Form

Field Summary
 
Fields inherited from class oracle.toplink.queryframework.ModifyAllQuery
INVALIDATE_CACHE, NO_CACHE
 
Fields inherited from class oracle.toplink.queryframework.DatabaseQuery
CascadeAggregateDelete, CascadeAllParts, CascadeByMapping, CascadeDependentParts, CascadePrivateParts, NoCascading
 
Constructor Summary
UpdateAllQuery()
          Constructs a default update all query.
UpdateAllQuery(java.lang.Class referenceClass)
          Constructs an update all query for the Class type specified.
UpdateAllQuery(java.lang.Class referenceClass, Expression selectionCriteria)
          Constructs an update all query for the specified Class type and selection criteria.
UpdateAllQuery(java.lang.Class referenceClass, ExpressionBuilder expressionBuilder)
          Constructs an update all query for the Class type specified and the given ExpressionBuilder.
 
Method Summary
 void addUpdate(Expression field, Expression value)
          Adds the update (SET) clause to the query.
 void addUpdate(Expression field, java.lang.Object value)
          Adds the update (SET) clause to the query.
 void addUpdate(java.lang.String attributeName, Expression value)
          Adds the update (SET) clause to the query.
 void addUpdate(java.lang.String attributeName, java.lang.Object value)
          Adds the update (SET) clause to the query.
 
Methods inherited from class oracle.toplink.queryframework.ModifyAllQuery
getCacheUsage, getExpressionBuilder, getReferenceClass, isModifyQuery, setCacheUsage, setReferenceClass, setShouldDeferExecutionInUOW, shouldDeferExecutionInUOW
 
Methods inherited from class oracle.toplink.queryframework.ModifyQuery
forceBatchStatementExecution, setForceBatchStatementExecution
 
Methods inherited from class oracle.toplink.queryframework.DatabaseQuery
addArgument, addArgument, addArgument, addArgumentValue, addArgumentValues, addCall, addStatement, bindAllParameters, cacheStatement, cascadeAllParts, cascadeByMapping, cascadePrivateParts, dontBindAllParameters, dontCacheStatement, dontCascadeParts, dontMaintainCache, getCall, getCalls, getDatasourceCall, getDatasourceCalls, getEJBQLString, getFlushOnExecute, getHintString, getJPQLString, getName, getQueryTimeout, getRedirector, getSelectionCriteria, getSessionName, getSQLStatement, getSQLString, getSQLStrings, getTranslatedSQLString, getTranslatedSQLStrings, hasSessionName, ignoreBindAllParameters, ignoreCacheStatement, isCallQuery, isDataModifyQuery, isDataReadQuery, isDeleteAllQuery, isDeleteObjectQuery, isDirectReadQuery, isExpressionQuery, isInsertObjectQuery, isModifyAllQuery, isNativeConnectionRequired, isObjectBuildingQuery, isObjectLevelModifyQuery, isObjectLevelReadQuery, isReadAllQuery, isReadObjectQuery, isReadQuery, isReportQuery, isSQLCallQuery, isUpdateObjectQuery, isValueReadQuery, isWriteObjectQuery, maintainCache, prepareCall, setCall, setDatasourceCall, setEJBQLString, setFlushOnExecute, setHintString, setIsNativeConnectionRequired, setJPQLString, setName, setQueryTimeout, setRedirector, setSelectionCriteria, setSessionName, setShouldBindAllParameters, setShouldCacheStatement, setShouldMaintainCache, setShouldPrepare, setShouldUseWrapperPolicy, setSQLStatement, setSQLString, shouldBindAllParameters, shouldCacheStatement, shouldCascadeAllParts, shouldCascadeByMapping, shouldCascadeParts, shouldCascadePrivateParts, shouldIgnoreBindAllParameters, shouldIgnoreCacheStatement, shouldMaintainCache, shouldPrepare, shouldUseWrapperPolicy, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UpdateAllQuery

public UpdateAllQuery()
Constructs a default update all query.


UpdateAllQuery

public UpdateAllQuery(java.lang.Class referenceClass)
Constructs an update all query for the Class type specified.

Parameters:
referenceClass - Class

UpdateAllQuery

public UpdateAllQuery(java.lang.Class referenceClass,
                      Expression selectionCriteria)
Constructs an update all query for the specified Class type and selection criteria.

Parameters:
referenceClass - Class type to be considered
selectionCriteria - Expression

UpdateAllQuery

public UpdateAllQuery(java.lang.Class referenceClass,
                      ExpressionBuilder expressionBuilder)
Constructs an update all query for the Class type specified and the given ExpressionBuilder. This sets the default builder which is used for all associated expressions in the query.

Parameters:
referenceClass - Class type to be considered
builder - ExpressionBuilder
Method Detail

addUpdate

public void addUpdate(Expression field,
                      java.lang.Object value)
Adds the update (SET) clause to the query. Uses default ExpressionBuilder.

Parameters:
field - Expression Object level representation of a database query 'where' clause
value - Object, the new value

addUpdate

public void addUpdate(java.lang.String attributeName,
                      java.lang.Object value)
Adds the update (SET) clause to the query. Uses default ExpressionBuilder.

Parameters:
attributeName - String, the name of the attribute
value - Object, the new value

addUpdate

public void addUpdate(Expression field,
                      Expression value)
Adds the update (SET) clause to the query. This method ensures that the builder has the session and reference class set for both given Expressions. Uses default ExpressionBuilder.

Parameters:
field - Expression, representation of a database query 'where' clause that describes the field
value - Expression, representation of a database query 'where' clause that describes the new value

addUpdate

public void addUpdate(java.lang.String attributeName,
                      Expression value)
Adds the update (SET) clause to the query. Uses default ExpressionBuilder.

Parameters:
attributeName - String, the name of the attribute
value - Expression, the new value

Copyright © 1998, 2010, Oracle. All Rights Reserved.