org.apache.cayenne.query

## Class PrefetchSelectQuery

- java.lang.Object
- - org.apache.cayenne.query.CacheableQuery
  - - org.apache.cayenne.query.AbstractQuery
    - - org.apache.cayenne.query.SelectQuery<Object>
      - - org.apache.cayenne.query.PrefetchSelectQuery

- All Implemented Interfaces:
    Serializable, ParameterizedQuery, Query, Select<Object>, XMLSerializable

      public class PrefetchSelectQuery
      extends SelectQuery<Object>

  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 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

      `canReturnScalarValue, columns, distinct, DISTINCT_DEFAULT, DISTINCT_PROPERTY, havingQualifier, orderings, qualifier`

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

      `dataMap, name, root`

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

      `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PrefetchSelectQuery(String prefetchPath, ObjRelationship lastPrefetchHint)` Creates a new disjoint prefetch select query.

  - ### Method Summary

    All Methods Instance Methods Concrete 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()` Returns last incoming ObjRelationship in the prefetch relationship chain.
    `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` | `setPrefetchPath(String prefetchPath)` Sets the prefetchPath.

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

      `addOrdering, addOrdering, addOrderings, addPrefetch, addPrefetch, aliasPathSplits, andHavingQualifier, andQualifier, batchIterator, canReturnScalarValue, clearOrderings, clearPrefetches, createQuery, createSQLAction, dataRowQuery, dataRowQuery, dataRowQuery, encodeAsXML, getBaseMetaData, getColumns, getFetchLimit, getFetchOffset, getHavingQualifier, getMetaData, getOrderings, getPageSize, getPrefetchTree, getQualifier, getStatementFetchSize, initWithProperties, isDistinct, isFetchingDataRows, iterate, iterator, orHavingQualifier, orQualifier, query, query, query, queryWithParameters, queryWithParameters, removeOrdering, removePrefetch, route, select, selectFirst, selectOne, setCanReturnScalarValue, setColumns, setColumns, setDistinct, setFetchingDataRows, setFetchLimit, setFetchOffset, setHavingQualifier, setPageSize, setPrefetchTree, setQualifier, setStatementFetchSize, setSuppressDistinct`

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

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

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

      `getCacheGroup, getCacheGroups, getCacheStrategy, setCacheGroup, setCacheGroups, setCacheStrategy, useLocalCache, useLocalCache, useLocalCache, useSharedCache, useSharedCache, useSharedCache`

    - ### 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`

- - ### Field Detail

    - #### 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

  - ### Method Detail

    - #### getPrefetchPath

          public String getPrefetchPath()

      Returns the prefetchPath.

    - #### setPrefetchPath

          public void setPrefetchPath(String prefetchPath)

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

    - #### getLastPrefetchHint

          public ObjRelationship getLastPrefetchHint()

      Returns 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 purpose 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–2023 Apache Cayenne. All rights reserved.