|
EclipseLink 1.1.0_ 1.1.0.r3634 API Reference | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.persistence.queries.DatabaseQuery
org.eclipse.persistence.queries.ModifyQuery
org.eclipse.persistence.queries.ModifyAllQuery
org.eclipse.persistence.queries.UpdateAllQuery
public class 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 | |
|---|---|
protected java.util.HashMap |
m_updateClauses
|
| Fields inherited from class org.eclipse.persistence.queries.ModifyAllQuery |
|---|
defaultBuilder, INVALIDATE_CACHE, isPreparedUsingTempStorage, NO_CACHE, referenceClass, referenceClassName, result |
| Fields inherited from class org.eclipse.persistence.queries.ModifyQuery |
|---|
forceBatchStatementExecution, modifyRow |
| 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 expressionBuilder)
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,
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: |
| Methods inherited from class org.eclipse.persistence.queries.ModifyQuery |
|---|
forceBatchStatementExecution, getModifyRow, setForceBatchStatementExecution, setModifyRow |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.util.HashMap m_updateClauses
| Constructor Detail |
|---|
public UpdateAllQuery()
public UpdateAllQuery(java.lang.Class referenceClass)
referenceClass - Class
public UpdateAllQuery(java.lang.Class referenceClass,
Expression selectionCriteria)
referenceClass - Class type to be consideredselectionCriteria - Expression
public UpdateAllQuery(java.lang.Class referenceClass,
ExpressionBuilder expressionBuilder)
referenceClass - Class type to be consideredbuilder - ExpressionBuilder| Method Detail |
|---|
public void addUpdate(Expression field,
java.lang.Object value)
field - Expression Object level representation of a database query 'where' clausevalue - Object, the new value
public void addUpdate(java.lang.String attributeName,
java.lang.Object value)
attributeName - String, the name of the attributevalue - Object, the new value
public 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 value
public void addUpdate(java.lang.String attributeName,
Expression value)
attributeName - String, the name of the attributevalue - Expression, the new value
protected void addUpdateInternal(java.lang.Object fieldObject,
java.lang.Object valueObject)
public java.lang.Object executeDatabaseQuery()
throws DatabaseException
executeDatabaseQuery in class DatabaseQueryDatabaseException - - an error has occurred on the database.protected QueryRedirector getDefaultRedirector()
getDefaultRedirector in class DatabaseQuerypublic java.util.HashMap getUpdateClauses()
public boolean isUpdateAllQuery()
isUpdateAllQuery in class DatabaseQuery
protected void prepare()
throws QueryException
prepare in class DatabaseQueryQueryExceptionprotected void initializeQuerySpecificDefaultBuilder()
initializeQuerySpecificDefaultBuilder in class ModifyAllQuery
|
EclipseLink 1.1.0_ 1.1.0.r3634 API Reference | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||