org.apache.cayenne.query

## Class SQLTemplateMetadata

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

- All Implemented Interfaces:
    Serializable, QueryMetadata

      public class SQLTemplateMetadata
      extends Object

  Since:
    3.0
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from interface org.apache.cayenne.query.QueryMetadata

      `CACHE_GROUPS_PROPERTY, CACHE_STRATEGY_PROPERTY, FETCH_LIMIT_DEFAULT, FETCH_LIMIT_PROPERTY, FETCH_OFFSET_DEFAULT, FETCH_OFFSET_PROPERTY, FETCHING_DATA_ROWS_DEFAULT, FETCHING_DATA_ROWS_PROPERTY, PAGE_SIZE_DEFAULT, PAGE_SIZE_PROPERTY, QUERY_TIMEOUT_DEFAULT, STATEMENT_FETCH_SIZE_DEFAULT, STATEMENT_FETCH_SIZE_PROPERTY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SQLTemplateMetadata()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getCacheGroup()` Returns an optional cache "group".
    `String` | `getCacheKey()` Returns a String that uniquely identifies this query for the purposes of result caching.
    `QueryCacheStrategy` | `getCacheStrategy()` Returns a caching strategy for this query.
    `ClassDescriptor` | `getClassDescriptor()`
    `DataMap` | `getDataMap()` Returns a DataMap associated with a query or null if no such DataMap exists.
    `DbEntity` | `getDbEntity()` Returns a DbEntity associated with a query or null if no such entity exists.
    `int` | `getFetchLimit()` Returns the limit on the maximum number of records that can be returned by this query.
    `int` | `getFetchOffset()` Specifies a start of a range when fetching a subset of records.
    `ObjEntity` | `getObjEntity()` Returns an ObjEntity associated with a query or null if no such entity exists.
    `Query` | `getOriginatingQuery()` Returns a query that originated this query.
    `int` | `getPageSize()` Returns query page size.
    `Map<String,String>` | `getPathSplitAliases()` Returns a map of aliases vs.
    `PrefetchTreeNode` | `getPrefetchTree()` Returns a root node of prefetch tree used by this query, or null of no prefetches are configured.
    `Procedure` | `getProcedure()` Returns a Procedure associated with a query or null if no such procedure exists.
    `int` | `getQueryTimeout()`
    `Function<?,?>` | `getResultMapper()`
    `List<Object>` | `getResultSetMapping()` Returns an optional list of result set mapping hints.
    `int` | `getStatementFetchSize()`
    `boolean` | `isFetchingDataRows()` Returns `true` if this query should produce a list of data rows as opposed to DataObjects, `false` for DataObjects.
    `boolean` | `isRefreshingObjects()` Returns `true` if the query results should replace any currently cached values, returns `false` otherwise.
    `boolean` | `isSingleResultSetMapping()`
    `boolean` | `isSuppressingDistinct()`
    `void` | `setCacheGroup(String group)`
    `void` | `setResultSetMapping(List<Object> resultSetMapping)` used by select translator

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

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

- - ### Constructor Detail

    - #### SQLTemplateMetadata

          public SQLTemplateMetadata()

  - ### Method Detail

    - #### isSingleResultSetMapping

          public boolean isSingleResultSetMapping()

      Specified by:
        `isSingleResultSetMapping` in interface `QueryMetadata`
      Returns:
        should the result be mapped to single object (scalar or entity)
      See Also:
        `QueryMetadata.getResultSetMapping()`

    - #### getResultMapper

          public Function<?,?> getResultMapper()

    - #### getCacheKey

          public String getCacheKey()

      Description copied from interface: `QueryMetadata`
      Returns a String that uniquely identifies this query for the purposes of result caching. If null is returned, no caching is performed.
      Specified by:
        `getCacheKey` in interface `QueryMetadata`
      Since:
        1.2

    - #### getDataMap

          public DataMap getDataMap()

      Description copied from interface: `QueryMetadata`
      Returns a DataMap associated with a query or null if no such DataMap exists.
      Specified by:
        `getDataMap` in interface `QueryMetadata`
      Since:
        1.2

    - #### getProcedure

          public Procedure getProcedure()

      Description copied from interface: `QueryMetadata`
      Returns a Procedure associated with a query or null if no such procedure exists.
      Specified by:
        `getProcedure` in interface `QueryMetadata`
      Since:
        1.2

    - #### getPathSplitAliases

          public Map<String,String> getPathSplitAliases()

      Description copied from interface: `QueryMetadata`
      Returns a map of aliases vs. expression subpaths that is used to build split joins.
      Specified by:
        `getPathSplitAliases` in interface `QueryMetadata`
      Since:
        3.0

    - #### getDbEntity

          public DbEntity getDbEntity()

      Description copied from interface: `QueryMetadata`
      Returns a DbEntity associated with a query or null if no such entity exists.
      Specified by:
        `getDbEntity` in interface `QueryMetadata`
      Since:
        1.2

    - #### getObjEntity

          public ObjEntity getObjEntity()

      Description copied from interface: `QueryMetadata`
      Returns an ObjEntity associated with a query or null if no such entity exists.
      Specified by:
        `getObjEntity` in interface `QueryMetadata`
      Since:
        1.2

    - #### getClassDescriptor

          public ClassDescriptor getClassDescriptor()

      Specified by:
        `getClassDescriptor` in interface `QueryMetadata`
      Since:
        3.0

    - #### getResultSetMapping

          public List<Object> getResultSetMapping()

      Description copied from interface: `QueryMetadata`
      Returns an optional list of result set mapping hints. Elements in the list can be either `EntityResultSegment` or `ScalarResultSegment`. The returned list can be null.
      Specified by:
        `getResultSetMapping` in interface `QueryMetadata`
      Since:
        3.0

    - #### setResultSetMapping

          public void setResultSetMapping(List<Object> resultSetMapping)

      used by select translator
      Specified by:
        `setResultSetMapping` in interface `QueryMetadata`
      Since:
        4.2

    - #### getPrefetchTree

          public PrefetchTreeNode getPrefetchTree()

      Description copied from interface: `QueryMetadata`
      Returns a root node of prefetch tree used by this query, or null of no prefetches are configured.
      Specified by:
        `getPrefetchTree` in interface `QueryMetadata`
      Since:
        1.2

    - #### getCacheStrategy

          public QueryCacheStrategy getCacheStrategy()

      Description copied from interface: `QueryMetadata`
      Returns a caching strategy for this query.
      Specified by:
        `getCacheStrategy` in interface `QueryMetadata`
      Since:
        3.0

    - #### getCacheGroup

          public String getCacheGroup()

      Description copied from interface: `QueryMetadata`
      Returns an optional cache "group". Cache groups allow to invalidate query caches in bulk on different events.
      Specified by:
        `getCacheGroup` in interface `QueryMetadata`
      Since:
        4.0

    - #### setCacheGroup

          public void setCacheGroup(String group)

      Since:
        4.0

    - #### isFetchingDataRows

          public boolean isFetchingDataRows()

      Description copied from interface: `QueryMetadata`
      Returns `true` if this query should produce a list of data rows as opposed to DataObjects, `false` for DataObjects. This is a hint to QueryEngine executing this query.
      Specified by:
        `isFetchingDataRows` in interface `QueryMetadata`

    - #### getFetchLimit

          public int getFetchLimit()

      Description copied from interface: `QueryMetadata`
      Returns the limit on the maximum number of records that can be returned by this query. If the actual number of rows in the result exceeds the fetch limit, they will be discarded. One possible use of fetch limit is using it as a safeguard against large result sets that may lead to the application running out of memory, etc. If a fetch limit is greater or equal to zero, all rows will be returned.
      Specified by:
        `getFetchLimit` in interface `QueryMetadata`
      Returns:
        the limit on the maximum number of records that can be returned by this query

    - #### getPageSize

          public int getPageSize()

      Description copied from interface: `QueryMetadata`
      Returns query page size. Page size is a hint to Cayenne that query should be performed page by page, instead of retrieving all results at once. If the value returned is less than or equal to zero, no paging should occur.
      Specified by:
        `getPageSize` in interface `QueryMetadata`

    - #### getOriginatingQuery

          public Query getOriginatingQuery()

      Description copied from interface: `QueryMetadata`
      Returns a query that originated this query. Originating query is a query whose result is needed to obtain the result of the query owning this metadata. Most often than not the returned value is null. One example of non-null originating query is a query for a range of objects in a previously fetched paginated list. The query that fetched the original paginated list is an "originated" query. It may be used to restore a list that got lost due to a cache overflow, etc.
      Specified by:
        `getOriginatingQuery` in interface `QueryMetadata`
      Since:
        4.0

    - #### getFetchOffset

          public int getFetchOffset()

      Description copied from interface: `QueryMetadata`
      Specifies a start of a range when fetching a subset of records.
      Specified by:
        `getFetchOffset` in interface `QueryMetadata`
      Since:
        3.0

    - #### isRefreshingObjects

          public boolean isRefreshingObjects()

      Description copied from interface: `QueryMetadata`
      Returns `true` if the query results should replace any currently cached values, returns `false` otherwise. If `QueryMetadata.isFetchingDataRows()` returns `true`, this setting is not applicable and has no effect.
      Specified by:
        `isRefreshingObjects` in interface `QueryMetadata`

    - #### getStatementFetchSize

          public int getStatementFetchSize()

      Specified by:
        `getStatementFetchSize` in interface `QueryMetadata`
      Returns:
        statement's fetch size
      Since:
        3.0

    - #### getQueryTimeout

          public int getQueryTimeout()

      Specified by:
        `getQueryTimeout` in interface `QueryMetadata`
      Returns:
        query timeout
      Since:
        4.2

    - #### isSuppressingDistinct

          public boolean isSuppressingDistinct()

      Specified by:
        `isSuppressingDistinct` in interface `QueryMetadata`
      Since:
        4.0

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