org.apache.cayenne.query

## Class PrefetchSelectQuery

- java.lang.Object
- - org.apache.cayenne.query.AbstractQuery
  - - org.apache.cayenne.query.QualifiedQuery
    - - org.apache.cayenne.query.SelectQuery
      - - org.apache.cayenne.query.PrefetchSelectQuery

- All Implemented Interfaces:
    Serializable, ConfigurationNode, ParameterizedQuery, Query, XMLSerializable

      public class PrefetchSelectQuery
      extends SelectQuery

  A SelectQuery to perform a prefetch based on another query. Used internally by Cayenne and is normally never used directly.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ObjRelationship` | `lastPrefetchHint` Stores the last ObjRelationship in the prefetch path.
    `protected SelectQuery` | `parentQuery` Deprecated. since 3.1 unused
    `protected String` | `prefetchPath` The relationship path from root objects to the objects being prefetched.
    `protected Collection<String>` | `resultPaths`

    - ### Fields inherited from class org.apache.cayenne.query.SelectQuery

      `distinct, DISTINCT_DEFAULT, DISTINCT_PROPERTY, orderings`

    - ### Fields inherited from class org.apache.cayenne.query.QualifiedQuery

      `qualifier`

    - ### Fields inherited from class org.apache.cayenne.query.AbstractQuery

      `dataMap, name, root`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PrefetchSelectQuery(SelectQuery parentQuery, String prefetchPath, ObjRelationship lastPrefetchHint)` Deprecated. Since 3.1 use another constructor without parentQuery parameter instead.
    `PrefetchSelectQuery(String prefetchPath, ObjRelationship lastPrefetchHint)` Creates a new disjoint prefetch select query.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addResultPath(String path)` Configures an "extra" path that will resolve to an extra column (or columns) in the result set.
    `ObjRelationship` | `getLastPrefetchHint()` Retunrs last incoming ObjRelationship in the prefetch relationship chain.
    `SelectQuery` | `getParentQuery()` Deprecated. since 3.1
    `String` | `getPrefetchPath()` Returns the prefetchPath.
    `Collection<String>` | `getResultPaths()` Returns extra result paths.
    `void` | `removeResultPath(String path)` Removes an extra result path.
    `void` | `setLastPrefetchHint(ObjRelationship relationship)`
    `void` | `setParentQuery(SelectQuery parentQuery)` Deprecated. since 3.1
    `void` | `setPrefetchPath(String prefetchPath)` Sets the prefetchPath.

    - ### Methods inherited from class org.apache.cayenne.query.SelectQuery

      `addOrdering, addOrdering, addOrderings, addPrefetch, aliasPathSplits, clearOrderings, clearPrefetches, createQuery, createSQLAction, encodeAsXML, getCacheGroups, getCacheStrategy, getFetchLimit, getFetchOffset, getMetaData, getOrderings, getPageSize, getPrefetchTree, getStatementFetchSize, initWithProperties, isDistinct, isFetchingDataRows, queryWithParameters, queryWithParameters, removeOrdering, removePrefetch, route, setCacheGroups, setCacheStrategy, setDistinct, setFetchingDataRows, setFetchLimit, setFetchOffset, setPageSize, setPrefetchTree, setStatementFetchSize`

    - ### Methods inherited from class org.apache.cayenne.query.QualifiedQuery

      `andQualifier, getQualifier, orQualifier, setQualifier`

    - ### Methods inherited from class org.apache.cayenne.query.AbstractQuery

      `acceptVisitor, getDataMap, getName, getRoot, setDataMap, setName, setRoot, toString`

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

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

    - ### Methods inherited from interface org.apache.cayenne.query.Query

      `getDataMap, getName`

    - ### Methods inherited from interface org.apache.cayenne.configuration.ConfigurationNode

      `acceptVisitor`

- - ### Field Detail

    - #### parentQuery

          @Deprecated
          protected SelectQuery parentQuery

      Deprecated. since 3.1 unused

    - #### prefetchPath

          protected String prefetchPath

      The relationship path from root objects to the objects being prefetched.

    - #### lastPrefetchHint

          protected ObjRelationship lastPrefetchHint

      Stores the last ObjRelationship in the prefetch path.

    - #### resultPaths

          protected Collection<String> resultPaths

  - ### Constructor Detail

    - #### PrefetchSelectQuery

          public PrefetchSelectQuery(String prefetchPath,
                                     ObjRelationship lastPrefetchHint)

      Creates a new disjoint prefetch select query.
      Since:
        3.1

    - #### PrefetchSelectQuery

          @Deprecated
          public PrefetchSelectQuery(SelectQuery parentQuery,
                                                  String prefetchPath,
                                                  ObjRelationship lastPrefetchHint)

      Deprecated. Since 3.1 use another constructor without parentQuery parameter instead.
      Creates a new disjoint prefetch select query.
      Since:
        1.2

  - ### Method Detail

    - #### getPrefetchPath

          public String getPrefetchPath()

      Returns the prefetchPath.

    - #### setPrefetchPath

          public void setPrefetchPath(String prefetchPath)

      Sets the prefetchPath.
      Parameters:
        `prefetchPath` - The prefetchPath to set

    - #### getParentQuery

          @Deprecated
          public SelectQuery getParentQuery()

      Deprecated. since 3.1
      Since:
        1.1

    - #### setParentQuery

          @Deprecated
          public void setParentQuery(SelectQuery parentQuery)

      Deprecated. since 3.1
      Since:
        1.1

    - #### getLastPrefetchHint

          public ObjRelationship getLastPrefetchHint()

      Retunrs last incoming ObjRelationship in the prefetch relationship chain.
      Since:
        1.1

    - #### setLastPrefetchHint

          public void setLastPrefetchHint(ObjRelationship relationship)

      Since:
        1.1

    - #### addResultPath

          public void addResultPath(String path)

      Configures an "extra" path that will resolve to an extra column (or columns) in the result set.
      Parameters:
        `path` - A valid path expression. E.g. "abc" or "db:ABC" or "abc.xyz".
      Since:
        1.2

    - #### removeResultPath

          public void removeResultPath(String path)

      Removes an extra result path. Note that this method doesn't check for expression invariants, as it doesn't have a proper context to do so. E.g. for the purspose of this method "db:ARTIST_NAME" and "obj:artistName" are not the same, though both will resolve to the same column name.

    - #### getResultPaths

          public Collection<String> getResultPaths()

      Returns extra result paths.
      Since:
        1.2

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