Class FluentSelect<T>

All Implemented Interfaces:
Serializable, Query, Select<T>
Direct Known Subclasses:
ColumnSelect, ObjectSelect

public abstract class FluentSelect<T> extends AbstractQuery implements Select<T>
Base class for ObjectSelect and ColumnSelect
Since:
4.0
See Also:
  • Field Details

  • Constructor Details

    • FluentSelect

      protected FluentSelect()
  • Method Details

    • resolveRoot

      protected Object resolveRoot(EntityResolver resolver)
    • getStatementFetchSize

      public int getStatementFetchSize()
    • getQueryTimeout

      public int getQueryTimeout()
      Since:
      4.2
    • getPageSize

      public int getPageSize()
    • getLimit

      public int getLimit()
    • getOffset

      public int getOffset()
    • getEntityType

      public Class<?> getEntityType()
    • getEntityName

      public String getEntityName()
    • getDbEntityName

      public String getDbEntityName()
    • getWhere

      public Expression getWhere()
      Returns a WHERE clause Expression of this query.
    • getHaving

      public Expression getHaving()
      Returns a HAVING clause Expression of this query.
    • getOrderings

      public Collection<Ordering> getOrderings()
    • getPrefetches

      public PrefetchTreeNode getPrefetches()
    • select

      public List<T> select(ObjectContext context)
      Description copied from interface: Select
      Selects objects using provided context.

      Essentially the inversion of "ObjectContext.select(Select)".

      Specified by:
      select in interface Select<T>
    • selectOne

      public T selectOne(ObjectContext context)
      Description copied from interface: Select
      Selects a single object using provided context. The query is expected to match zero or one object. It returns null if no objects were matched. If query matched more than one object, CayenneRuntimeException is thrown.

      Essentially the inversion of "ObjectContext.selectOne(Select)".

      Specified by:
      selectOne in interface Select<T>
    • iterate

      public void iterate(ObjectContext context, ResultIteratorCallback<T> callback)
      Description copied from interface: Select
      Creates a ResultIterator based on the provided context and passes it to a callback for processing. The caller does not need to worry about closing the iterator. This method takes care of it.

      Essentially the inversion of "ObjectContext.iterate(Select, ResultIteratorCallback)".

      Specified by:
      iterate in interface Select<T>
    • iterator

      public ResultIterator<T> iterator(ObjectContext context)
      Description copied from interface: Select
      Creates a ResultIterator based on the provided context. It is usually backed by an open result set and is useful for processing of large data sets, preserving a constant memory footprint. The caller must wrap iteration in try/finally (or try-with-resources for Java 1.7 and higher) and close the ResultIterator explicitly. Or use Select.iterate(ObjectContext, ResultIteratorCallback) as an alternative.

      Essentially the inversion of "ObjectContext.iterator(Select)".

      Specified by:
      iterator in interface Select<T>
    • batchIterator

      public ResultBatchIterator<T> batchIterator(ObjectContext context, int size)
      Description copied from interface: Select
      Creates a ResultBatchIterator based on the provided context and batch size. It is usually backed by an open result set and is useful for processing of large data sets, preserving a constant memory footprint. The caller must wrap iteration in try/finally (or try-with-resources for Java 1.7 and higher) and close the ResultBatchIterator explicitly.
      Specified by:
      batchIterator in interface Select<T>
    • createSQLAction

      public SQLAction createSQLAction(SQLActionVisitor visitor)
      Description copied from interface: Query
      A callback method invoked by Cayenne during the final execution phase of the query run. A concrete query implementation is given a chance to decide how it should be handled. Implementors can pick an appropriate method of the SQLActionVisitor to handle itself, create a custom SQLAction of its own, or substitute itself with another query that should be used for SQLAction construction.
      Specified by:
      createSQLAction in interface Query
      Specified by:
      createSQLAction in class AbstractQuery
    • route

      public void route(QueryRouter router, EntityResolver resolver, Query substitutedQuery)
      Description copied from class: AbstractQuery
      Implements default routing mechanism relying on the EntityResolver to find DataMap based on the query root. This mechanism should be sufficient for most queries that "know" their root.
      Specified by:
      route in interface Query
      Overrides:
      route in class AbstractQuery
    • isFetchingDataRows

      public boolean isFetchingDataRows()
    • routePrefetches

      protected void routePrefetches(QueryRouter router, EntityResolver resolver)
    • getColumns

      public Collection<Property<?>> getColumns()
      Since:
      4.2
    • isDistinct

      public boolean isDistinct()
      Since:
      4.2
    • initWithProperties

      public void initWithProperties(Map<String,String> properties)
      Since:
      4.2