|
Oracle TopLink Java API Reference 10g Release 3 (10.1.3.1) B28219-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.toplink.queryframework.DatabaseQuery
oracle.toplink.queryframework.ModifyQuery
oracle.toplink.queryframework.UpdateAllQuery
PUBLIC: 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");
Field Summary | |
static int |
INVALIDATE_CACHE Cache usage flag indicating that there are objects in the cache which are invalid. |
static int |
NO_CACHE Cache usage flag indicating that the cache is valid. |
Fields inherited from class oracle.toplink.queryframework.DatabaseQuery |
CascadeAggregateDelete, CascadeAllParts, CascadeByMapping, CascadeDependentParts, CascadePrivateParts, NoCascading |
Constructor Summary | |
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 builder) PUBLIC: Constructs an update all query for the Class type specified and the given ExpressionBuilder. |
Method Summary | |
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, java.lang.Object value) PUBLIC: Adds the update (SET) clause to the query. |
int |
getCacheUsage() PUBLIC: Returns the cache usage for this update all query. |
ExpressionBuilder |
getExpressionBuilder() PUBLIC: Returns the expression builder which should be used for this update all query. |
java.lang.Class |
getReferenceClass() PUBLIC: Returns the reference Class type for this update all query. |
void |
setCacheUsage(int cacheUsage) PUBLIC: Sets the level of cache support for this query. |
void |
setExpressionBuilder(ExpressionBuilder builder) PUBLIC: Sets the expression builder which should be used for this update all query. |
void |
setReferenceClass(java.lang.Class referenceClass) PUBLIC: Sets the reference class for this update all query. |
void |
setShouldDeferExecutionInUOW(boolean shouldDeferExecutionInUOW) PUBLIC: Sets a flag indicating whether the execution of the update all query should be deferred until the UOW commits. |
boolean |
shouldDeferExecutionInUOW() PUBLIC: Returns a boolean indicating whether the query's execution is deferred in a UOW until it commits. |
Methods inherited from class oracle.toplink.queryframework.ModifyQuery |
forceBatchStatementExecution, isModifyQuery, setForceBatchStatementExecution |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int NO_CACHE
public static final int INVALIDATE_CACHE
Constructor Detail |
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 builder)
referenceClass
- Class type to be consideredbuilder
- ExpressionBuilderMethod Detail |
public 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 int getCacheUsage()
public ExpressionBuilder getExpressionBuilder()
public java.lang.Class getReferenceClass()
getReferenceClass
in class DatabaseQuery
public void setCacheUsage(int cacheUsage)
cacheUsage
- int value, UpdateAllQuery.NO_CACHE or UpdateAllQuery.INVALIDATE_CACHEpublic void setExpressionBuilder(ExpressionBuilder builder)
builder
- ExpressionBuilderpublic void setReferenceClass(java.lang.Class referenceClass)
referenceClass
- Classpublic void setShouldDeferExecutionInUOW(boolean shouldDeferExecutionInUOW)
shouldDeferExecutionInUOW
- boolean - set to true if execution in UOW is to be deferredpublic boolean shouldDeferExecutionInUOW()
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |