|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cayenne.query.BatchQuery
public abstract class BatchQuery
BatchQuery and its descendants allow to group similar data for the batch database modifications, including inserts, updates and deletes. Single BatchQuery corresponds to a parameterized PreparedStatement and a matrix of values.
Field Summary | |
---|---|
protected int |
batchIndex
|
protected DbEntity |
dbEntity
|
protected java.lang.String |
name
|
Constructor Summary | |
---|---|
BatchQuery(DbEntity dbEntity)
|
Method Summary | |
---|---|
SQLAction |
createSQLAction(SQLActionVisitor visitor)
Calls "batchAction" on the visitor. |
abstract java.util.List |
getDbAttributes()
Returns a list of DbAttributes describing batch parameters. |
DbEntity |
getDbEntity()
Returns a DbEntity associated with this batch. |
QueryMetadata |
getMetaData(EntityResolver resolver)
Returns default select parameters. |
java.lang.String |
getName()
Returns a symbolic name of the query. |
java.lang.Object |
getObject(int valueIndex)
Deprecated. Since 1.2 renamed to "getValue()" |
ObjectId |
getObjectId()
Returns an ObjectId associated with the current batch iteration. |
java.lang.Object |
getRoot()
Deprecated. since 1.2 as the corresponding interface method is also deprecated. |
abstract java.lang.Object |
getValue(int valueIndex)
Returns a value at a given index for the current batch iteration. |
protected java.lang.Object |
getValue(java.util.Map valueMap,
DbAttribute attribute)
A helper method used by subclasses to resolve deferred values on demand. |
java.util.List |
getValuesForUpdateParameters(boolean includeNullValues)
Deprecated. Since 1.2 use BatchQueryBuilder.getParameterValues(), as this allows better control over which attributes are logged. |
boolean |
isEmpty()
Returns true if this batch query has no parameter rows. |
boolean |
isUsingOptimisticLocking()
Returns true if the batch query uses optimistic locking. |
boolean |
next()
Repositions batch to the next object, so that subsequent calls to getObject(int) would return the values of the next batch object. |
void |
reset()
Rewinds batch to the first parameter row. |
void |
route(QueryRouter router,
EntityResolver resolver,
Query substitutedQuery)
A callback method invoked by Cayenne during the routing phase of the query execution. |
void |
setName(java.lang.String name)
Sets a symbolic name of the query. |
void |
setRoot(java.lang.Object root)
Deprecated. since 1.2 |
abstract int |
size()
Returns the number of parameter rows in a batch. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int batchIndex
protected DbEntity dbEntity
protected java.lang.String name
Constructor Detail |
---|
public BatchQuery(DbEntity dbEntity)
Method Detail |
---|
public java.lang.String getName()
Query
getName
in interface Query
public void setName(java.lang.String name)
Query
setName
in interface Query
public QueryMetadata getMetaData(EntityResolver resolver)
getMetaData
in interface Query
public java.lang.Object getRoot()
Query
getRoot
in interface Query
public void setRoot(java.lang.Object root)
Query
setRoot
in interface Query
public void route(QueryRouter router, EntityResolver resolver, Query substitutedQuery)
Query
QueryRouter.route(QueryEngine, Query, Query)
callback method to route
itself. Query can create one or more substitute queries or even provide its own
QueryEngine to execute itself.
route
in interface Query
public SQLAction createSQLAction(SQLActionVisitor visitor)
createSQLAction
in interface Query
public boolean isUsingOptimisticLocking()
public DbEntity getDbEntity()
public java.util.List getValuesForUpdateParameters(boolean includeNullValues)
includeNullValues
- A true
value indicates that the returned
list should include null
values and false
indicates they should not be included.public boolean isEmpty()
true
if this batch query has no parameter rows.
public abstract java.util.List getDbAttributes()
public void reset()
public boolean next()
true
if
batch has more objects to iterate over, false
otherwise.
public java.lang.Object getObject(int valueIndex)
public abstract java.lang.Object getValue(int valueIndex)
public abstract int size()
protected java.lang.Object getValue(java.util.Map valueMap, DbAttribute attribute)
public ObjectId getObjectId()
Default implementation simply returns null.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |