Class SelectById<T>

java.lang.Object
org.apache.cayenne.query.IndirectQuery
org.apache.cayenne.query.SelectById<T>
All Implemented Interfaces:
Query, Select<T>

@Deprecated(since="5.0", forRemoval=true) public class SelectById<T> extends IndirectQuery implements Select<T>
Deprecated, for removal: This API element is subject to removal in a future version.
this query is a thin wrapper around an ObjectSelect. Use FluentSelect.byId(Object) or "byIds(..)" methods.
A query to select objects by id.
Since:
4.0
  • Constructor Details

    • SelectById

      protected SelectById(SelectById.QueryRoot root, SelectById.IdSpec idSpec, boolean fetchingDataRows)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • SelectById

      protected SelectById(SelectById.QueryRoot root, SelectById.IdSpec idSpec)
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • queryId

      public static <T> SelectById<T> queryId(Class<T> entityType, Object id)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      5.0
    • queryMap

      public static <T> SelectById<T> queryMap(Class<T> entityType, Map<String,?> id)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      5.0
    • queryObjectId

      public static <T> SelectById<T> queryObjectId(Class<T> entityType, ObjectId id)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      5.0
    • queryIds

      public static <T> SelectById<T> queryIds(Class<T> entityType, Object... ids)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      5.0
    • queryIdsCollection

      public static <T> SelectById<T> queryIdsCollection(Class<T> entityType, Collection<Object> ids)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      5.0
    • queryMaps

      @SafeVarargs public static <T> SelectById<T> queryMaps(Class<T> entityType, Map<String,?>... ids)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      5.0
    • queryMapsCollection

      public static <T> SelectById<T> queryMapsCollection(Class<T> entityType, Collection<Map<String,?>> ids)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      5.0
    • queryObjectIds

      public static <T> SelectById<T> queryObjectIds(Class<T> entityType, ObjectId... ids)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      5.0
    • queryObjectIdsCollection

      public static <T> SelectById<T> queryObjectIdsCollection(Class<T> entityType, Collection<ObjectId> ids)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      5.0
    • query

      @Deprecated(since="5.0", forRemoval=true) public static <T> SelectById<T> query(Class<T> entityType, Object id)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      4.2
    • query

      @Deprecated(since="5.0", forRemoval=true) public static <T> SelectById<T> query(Class<T> entityType, Map<String,?> id)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      4.2
    • query

      @Deprecated(since="5.0", forRemoval=true) public static <T> SelectById<T> query(Class<T> entityType, ObjectId id)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      4.2
    • query

      @Deprecated(since="5.0", forRemoval=true) public static <T> SelectById<T> query(Class<T> entityType, Object firstId, Object... otherIds)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      4.2
    • query

      @Deprecated(since="5.0", forRemoval=true) public static <T> SelectById<T> query(Class<T> entityType, Collection<Object> ids)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      4.2
    • query

      @Deprecated(since="5.0", forRemoval=true) @SafeVarargs public static <T> SelectById<T> query(Class<T> entityType, Map<String,?> firstId, Map<String,?>... otherIds)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      4.2
    • query

      @Deprecated(since="5.0", forRemoval=true) public static <T> SelectById<T> query(Class<T> entityType, ObjectId firstId, ObjectId... otherIds)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      4.2
    • dataRowQueryId

      public static SelectById<DataRow> dataRowQueryId(Class<?> entityType, Object id)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      5.0
    • dataRowQueryMap

      public static SelectById<DataRow> dataRowQueryMap(Class<?> entityType, Map<String,?> id)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      5.0
    • dataRowQueryObjectId

      public static SelectById<DataRow> dataRowQueryObjectId(ObjectId id)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      5.0
    • dataRowQueryIds

      public static SelectById<DataRow> dataRowQueryIds(Class<?> entityType, Object... ids)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      5.0
    • dataRowQueryIdsCollection

      public static SelectById<DataRow> dataRowQueryIdsCollection(Class<?> entityType, Collection<Object> ids)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      5.0
    • dataRowQueryMaps

      @SafeVarargs public static SelectById<DataRow> dataRowQueryMaps(Class<?> entityType, Map<String,?>... ids)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      5.0
    • dataRowQueryMapsCollection

      public static SelectById<DataRow> dataRowQueryMapsCollection(Class<?> entityType, Collection<Map<String,?>> ids)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      5.0
    • dataRowQueryObjectIds

      public static SelectById<DataRow> dataRowQueryObjectIds(ObjectId... ids)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      5.0
    • dataRowQueryObjectIdsCollection

      public static SelectById<DataRow> dataRowQueryObjectIdsCollection(Collection<ObjectId> ids)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      5.0
    • dataRowQuery

      @Deprecated(since="5.0", forRemoval=true) public static SelectById<DataRow> dataRowQuery(Class<?> entityType, Object id)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • dataRowQuery

      @Deprecated(since="5.0", forRemoval=true) public static SelectById<DataRow> dataRowQuery(Class<?> entityType, Map<String,?> id)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • dataRowQuery

      @Deprecated(since="5.0", forRemoval=true) public static SelectById<DataRow> dataRowQuery(ObjectId id)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • dataRowQuery

      @Deprecated(since="5.0", forRemoval=true) public static SelectById<DataRow> dataRowQuery(Class<?> entityType, Object firstId, Object... otherIds)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      4.2
    • dataRowQuery

      @Deprecated(since="5.0", forRemoval=true) @SafeVarargs public static SelectById<DataRow> dataRowQuery(Class<?> entityType, Map<String,?> firstId, Map<String,?>... otherIds)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      4.2
    • dataRowQuery

      @Deprecated(since="5.0", forRemoval=true) public static SelectById<DataRow> dataRowQuery(ObjectId firstId, ObjectId... otherIds)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since:
      4.2
    • selectFirst

      public T selectFirst(ObjectContext context)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Select
      Selects a single object using provided context. The query itself can match any number of objects, but will return only the first one. It returns null if no objects were matched.

      If it matched more than one object, the first object from the list is returned. This makes 'selectFirst' different from Select.selectOne(ObjectContext), which would throw in this situation. 'selectFirst' is useful e.g. when the query is ordered and we only want to see the first object (e.g. "most recent news article"), etc.

      Selecting the first object via "Select.selectFirst(ObjectContext)" is more comprehensible than selecting via "ObjectContext.selectFirst(Select)", because implementations of "Select" set fetch size limit to one.

      Specified by:
      selectFirst in interface Select<T>
    • localCache

      public SelectById<T> localCache(String cacheGroup)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Instructs Cayenne to look for query results in the "local" cache when running the query. This is a short-hand notation for:
      query.cacheStrategy(QueryCacheStrategy.LOCAL_CACHE, cacheGroup);
      
    • localCache

      public SelectById<T> localCache()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Instructs Cayenne to look for query results in the "local" cache when running the query. This is a short-hand notation for:
      query.cacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
      
    • sharedCache

      public SelectById<T> sharedCache(String cacheGroup)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Instructs Cayenne to look for query results in the "shared" cache when running the query. This is a short-hand notation for:
      query.cacheStrategy(QueryCacheStrategy.SHARED_CACHE, cacheGroup);
      
    • sharedCache

      public SelectById<T> sharedCache()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Instructs Cayenne to look for query results in the "shared" cache when running the query. This is a short-hand notation for:
      query.cacheStrategy(QueryCacheStrategy.SHARED_CACHE);
      
    • getCacheStrategy

      public QueryCacheStrategy getCacheStrategy()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • cacheStrategy

      public SelectById<T> cacheStrategy(QueryCacheStrategy strategy)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • cacheStrategy

      public SelectById<T> cacheStrategy(QueryCacheStrategy strategy, String cacheGroup)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getCacheGroup

      public String getCacheGroup()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • cacheGroup

      public SelectById<T> cacheGroup(String cacheGroup)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • isFetchingDataRows

      public boolean isFetchingDataRows()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • prefetch

      public SelectById<T> prefetch(PrefetchTreeNode prefetch)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Merges prefetch into the query prefetch tree.
      Returns:
      this object
    • prefetch

      public SelectById<T> prefetch(String path, int semantics)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Merges a prefetch path with specified semantics into the query prefetch tree.
      Returns:
      this object
    • getPrefetches

      public PrefetchTreeNode getPrefetches()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • createReplacementQuery

      protected Query createReplacementQuery(EntityResolver resolver)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from class: IndirectQuery
      Creates a substitute query. An implementor is free to provide an arbitrary replacement query.
      Specified by:
      createReplacementQuery in class IndirectQuery