|
||||||||||
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 DataMap |
dataMap
|
protected DbEntity |
dbEntity
|
protected java.lang.String |
name
|
Constructor Summary | |
---|---|
BatchQuery(DbEntity dbEntity)
|
Method Summary | ||
---|---|---|
|
acceptVisitor(ConfigurationNodeVisitor<T> visitor)
|
|
SQLAction |
createSQLAction(SQLActionVisitor visitor)
Calls "batchAction" on the visitor. |
|
DataMap |
getDataMap()
|
|
abstract java.util.List<DbAttribute> |
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. |
|
ObjectId |
getObjectId()
Returns an ObjectId associated with the current batch iteration. |
|
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<java.lang.String,java.lang.Object> valueMap,
DbAttribute attribute)
A helper method used by subclasses to resolve deferred values on demand. |
|
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 |
setDataMap(DataMap dataMap)
|
|
void |
setName(java.lang.String name)
|
|
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
protected DataMap dataMap
Constructor Detail |
---|
public BatchQuery(DbEntity dbEntity)
Method Detail |
---|
public <T> T acceptVisitor(ConfigurationNodeVisitor<T> visitor)
acceptVisitor
in interface ConfigurationNode
public java.lang.String getName()
Query
getName
in interface Query
public void setName(java.lang.String name)
public DataMap getDataMap()
getDataMap
in interface Query
public void setDataMap(DataMap dataMap)
public QueryMetadata getMetaData(EntityResolver resolver)
getMetaData
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 boolean isEmpty()
true
if this batch query has no parameter rows.
public abstract java.util.List<DbAttribute> getDbAttributes()
public void reset()
public boolean next()
true
if
batch has more objects to iterate over, false
otherwise.
public abstract java.lang.Object getValue(int valueIndex)
public abstract int size()
protected java.lang.Object getValue(java.util.Map<java.lang.String,java.lang.Object> 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 |