Class InsertBatchQuery
java.lang.Object
org.apache.cayenne.query.BatchQuery
org.apache.cayenne.query.InsertBatchQuery
- All Implemented Interfaces:
Serializable, Query
Batched INSERT query. Allows inserting multiple object snapshots (DataRows)
for a given DbEntity in a single query. InsertBatchQuery normally is not used
directly. Rather DataContext creates one internally when committing
Persistent objects.
- See Also:
-
Field Summary
Fields inherited from class BatchQuery
dbAttributes, dbEntity, rowsModifier and TypeFieldDescriptionprotected List<DbAttribute> protected DbEntityprotected List<BatchQueryRow> -
Constructor Summary
ConstructorsConstructorDescriptionInsertBatchQuery(DbEntity entity, int batchCapacity) Creates new InsertBatchQuery for a given DbEntity and estimated capacity. -
Method Summary
Methods inherited from class BatchQuery
createSQLAction, getDbAttributes, getDbEntity, getMetaData, getRows, isUsingOptimisticLocking, routeModifier and TypeMethodDescriptioncreateSQLAction(SQLActionVisitor visitor) Calls "batchAction" on the visitor.Returns a list of DbAttributes describing batch parameters.Returns a DbEntity associated with this batch.getMetaData(EntityResolver resolver) Returns default select parameters.getRows()booleanReturns true if the batch query uses optimistic locking.voidroute(QueryRouter router, EntityResolver resolver, Query substitutedQuery) A callback method invoked by Cayenne during the routing phase of the query execution.
-
Constructor Details
-
InsertBatchQuery
Creates new InsertBatchQuery for a given DbEntity and estimated capacity.
-
-
Method Details
-
add
-
add
Adds a snapshot to batch. Optionally stores the object id for the snapshot. Note that snapshot can hold either the real values or the instances of java.util.Supplier that will be resolved to the actual value on the spot, thus allowing deferred propagated keys resolution.- Since:
- 1.2
-