Class InsertBatchQuery

java.lang.Object
org.apache.cayenne.query.BatchQuery
org.apache.cayenne.query.InsertBatchQuery
All Implemented Interfaces:
Serializable, Query

public class InsertBatchQuery
extends BatchQuery
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 DataObjects.
See Also:
Serialized Form
  • Constructor Details

    • InsertBatchQuery

      public InsertBatchQuery​(DbEntity entity, int batchCapacity)
      Creates new InsertBatchQuery for a given DbEntity and estimated capacity.
  • Method Details

    • add

      public void add​(Map<String,​Object> snapshot)
      Adds a snapshot to batch. A shortcut for "add(snapshot, null)".
    • add

      public void add​(Map<String,​Object> snapshot, ObjectId id)
      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