org.apache.cayenne.query

## Class BatchQuery

- java.lang.Object
- - org.apache.cayenne.query.BatchQuery

- All Implemented Interfaces:
    Serializable, Query
  Direct Known Subclasses:
    DeleteBatchQuery, InsertBatchQuery, UpdateBatchQuery

      public abstract class BatchQuery
      extends Object
      implements Query

  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.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected DataMap` | `dataMap` Deprecated.
    `protected List<DbAttribute>` | `dbAttributes`
    `protected DbEntity` | `dbEntity`
    `protected String` | `name` Deprecated.
    `protected List<BatchQueryRow>` | `rows`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BatchQuery(DbEntity dbEntity, List<DbAttribute> dbAttributes, int batchCapacity)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `SQLAction` | `createSQLAction(SQLActionVisitor visitor)` Calls "batchAction" on the visitor.
    `DataMap` | `getDataMap()` Deprecated.
    `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.
    `String` | `getName()` Deprecated.
    `List<BatchQueryRow>` | `getRows()`
    `boolean` | `isUsingOptimisticLocking()` Returns true if the batch query uses optimistic locking.
    `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)` Deprecated.
    `void` | `setName(String name)`
    `int` | `size()` Deprecated. since 4.0 use getRows().size().

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### dbEntity

          protected DbEntity dbEntity

      Since:
        1.2

    - #### name

          @Deprecated
          protected String name

      Deprecated.

    - #### dataMap

          @Deprecated
          protected DataMap dataMap

      Deprecated.
      Since:
        3.1

    - #### rows

          protected List<BatchQueryRow> rows

      Since:
        4.0

    - #### dbAttributes

          protected List<DbAttribute> dbAttributes

  - ### Constructor Detail

    - #### BatchQuery

          public BatchQuery(DbEntity dbEntity,
                            List<DbAttribute> dbAttributes,
                            int batchCapacity)

      Since:
        4.0

  - ### Method Detail

    - #### getRows

          public List<BatchQueryRow> getRows()

      Since:
        4.0

    - #### getName

          @Deprecated
          public String getName()

      Deprecated.
      Description copied from interface: `Query`
      Returns a symbolic name of the query. The name is normally used as a key to find queries stored in the DataMap.
      Specified by:
        `getName` in interface `Query`

    - #### setName

          public void setName(String name)

    - #### getDataMap

          @Deprecated
          public DataMap getDataMap()

      Deprecated.
      Specified by:
        `getDataMap` in interface `Query`
      Since:
        3.1

    - #### setDataMap

          @Deprecated
          public void setDataMap(DataMap dataMap)

      Deprecated.
      Since:
        3.1

    - #### getMetaData

          public QueryMetadata getMetaData(EntityResolver resolver)

      Returns default select parameters.
      Specified by:
        `getMetaData` in interface `Query`
      Since:
        1.2

    - #### route

          public void route(QueryRouter router,
                            EntityResolver resolver,
                            Query substitutedQuery)

      Description copied from interface: `Query`
      A callback method invoked by Cayenne during the routing phase of the query execution. Mapping of DataNodes is provided by QueryRouter. Query should use a `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.
      Specified by:
        `route` in interface `Query`
      Since:
        1.2

    - #### createSQLAction

          public SQLAction createSQLAction(SQLActionVisitor visitor)

      Calls "batchAction" on the visitor.
      Specified by:
        `createSQLAction` in interface `Query`
      Since:
        1.2

    - #### isUsingOptimisticLocking

          public boolean isUsingOptimisticLocking()

      Returns true if the batch query uses optimistic locking.
      Since:
        1.1

    - #### getDbEntity

          public DbEntity getDbEntity()

      Returns a DbEntity associated with this batch.

    - #### getDbAttributes

          public List<DbAttribute> getDbAttributes()

      Returns a list of DbAttributes describing batch parameters.

    - #### size

          @Deprecated
          public int size()

      Deprecated. since 4.0 use getRows().size().

Copyright © 2001–2018 Apache Cayenne. All rights reserved.