E - the generic type of the queried object (typically a Bean).SELF - the generic type of this query itself (this) for fluent API calls.T - the generic type of the internal results. See getMapper().public abstract class AbstractSelectStatement<E,SELF extends SelectStatement<E,SELF>,T> extends AbstractStatement<E,SELF> implements SelectStatement<E,SELF>
SelectStatement.| Modifier and Type | Field and Description |
|---|---|
private Function<T,E> |
mapper |
private PropertyPath<?>[] |
selectionPaths |
| Constructor and Description |
|---|
AbstractSelectStatement(SqlDialect dialect,
EntityAlias<?> alias,
Function<T,E> mapper,
Class<E> toClass,
PropertyPath<?>... constructorArgs)
The constructor.
|
AbstractSelectStatement(SqlDialect dialect,
EntityAlias<?> alias,
Function<T,E> mapper,
PropertyPath<?>... paths)
The constructor.
|
AbstractSelectStatement(SqlDialect dialect,
EntityAlias<E> alias,
Function<T,E> mapper)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
buildStart(SqlBuilder builder) |
protected String |
createSqlSingleQuery(QueryMode mode) |
protected abstract Object |
doExecute(String sql,
QueryMode mode,
Long offset,
Integer limit)
Creates a select query with the given
SQL and the given arguments. |
Object |
execute(String sql,
QueryMode mode)
Creates a select query with the given
SQL and the given QueryMode. |
Function<T,E> |
getMapper() |
PropertyPath<?>[] |
getSelectionPaths() |
SELF |
groupBy(PropertyPath<?> path)
Adds the given
PropertyPath to the GROUP BY clause. |
SELF |
limit(int limit)
Set the limit for the query matches.
|
SELF |
offset(long offset)
Set the offset for the query results.
|
SELF |
orderBy(ComparablePath<?> path,
SortOrder order)
Adds the given
PropertyPath to the ORDER BY clause. |
ListQuery<E> |
query() |
NumberQuery<Long> |
queryCount() |
SingleQuery<E> |
queryFirst() |
SingleQuery<E> |
queryOne() |
protected SingleQuery<E> |
querySingle(QueryMode mode) |
SELF |
where(Expression... expressions)
Adds the given
Expressions as filter criteria to the WHERE-clause. |
addAlias, addAliases, build, createFeature, createSqlBuilder, feature, getAlias, getBuilder, getDialect, getFeature, getParameters, getResultClass, getSql, isSupportingAlias, self, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetAlias, getDialect, getParameters, getSql, toStringfetch, fetchCount, fetchFirst, fetchFirstRequired, fetchOne, fetchOneRequiredorderByprivate final PropertyPath<?>[] selectionPaths
public AbstractSelectStatement(SqlDialect dialect, EntityAlias<E> alias, Function<T,E> mapper)
dialect - - see AbstractStatement.getDialect().alias - - see AbstractStatement.getAlias().mapper - - see getMapper().public AbstractSelectStatement(SqlDialect dialect, EntityAlias<?> alias, Function<T,E> mapper, PropertyPath<?>... paths)
dialect - - see AbstractStatement.getDialect().alias - - see AbstractStatement.getAlias().mapper - - see getMapper().paths - - see
FeatureSelect.selectFrom(EntityAlias, Class, PropertyPath...)
.public AbstractSelectStatement(SqlDialect dialect, EntityAlias<?> alias, Function<T,E> mapper, Class<E> toClass, PropertyPath<?>... constructorArgs)
dialect - - see AbstractStatement.getDialect().alias - - see AbstractStatement.getAlias().mapper - - see getMapper().toClass - - see
net.sf.mmm.util.query.api.statement.StatementFactory#selectFrom(EntityAlias, Class, Path...).constructorArgs - - see
net.sf.mmm.util.query.api.statement.StatementFactory#selectFrom(EntityAlias, Class, Path...).public PropertyPath<?>[] getSelectionPaths()
tuple or
constructor queries or null for
regular select querypublic SELF where(Expression... expressions)
FeatureWhereExpressions as filter criteria to the WHERE-clause. Multiple invocations will combine
Expressions with logical AND but it is preferred to use a
single invocation.where in interface FeatureWhere<SELF extends SelectStatement<E,SELF>>expressions - the Expressions to add.public SELF orderBy(ComparablePath<?> path, SortOrder order)
FeatureOrderByPropertyPath to the ORDER BY clause.orderBy in interface FeatureOrderBy<SELF extends SelectStatement<E,SELF>>path - the PropertyPath to order by.order - the SortOrder.public SELF groupBy(PropertyPath<?> path)
FeatureGroupByPropertyPath to the GROUP BY clause.groupBy in interface FeatureGroupBy<SELF extends SelectStatement<E,SELF>>path - the PropertyPath to group by.public SELF limit(int limit)
FeatureLimitlimit in interface FeatureLimit<SELF extends SelectStatement<E,SELF>>limit - the limit for the maximum number of matches for the query.public SELF offset(long offset)
FeaturePagingFeatureLimit.limit(int)).offset in interface FeaturePaging<SELF extends SelectStatement<E,SELF>>offset - the number of results to skip.protected void buildStart(SqlBuilder builder)
buildStart in class AbstractStatement<E,SELF extends SelectStatement<E,SELF>>builder - the SqlBuilder with the query context to build the SQL and bind variables.public Object execute(String sql, QueryMode mode)
SQL and the given QueryMode.sql - the SQL to execute.mode - the QueryMode.protected abstract Object doExecute(String sql, QueryMode mode, Long offset, Integer limit)
SQL and the given arguments.public ListQuery<E> query()
query in interface FeatureFetch<E>ListQuery to fetch all matching results with a regular SELECT.public NumberQuery<Long> queryCount()
queryCount in interface FeatureFetch<E>NumberQuery to fetch the number of matching objects with a SELECT COUNT.protected SingleQuery<E> querySingle(QueryMode mode)
mode - the QueryMode.SingleQuery.queryFirst(),
queryOne()protected String createSqlSingleQuery(QueryMode mode)
mode - the QueryMode for a single SELECT query what is QueryMode.FIRST or
QueryMode.UNIQUE.SQL for a single query.public SingleQuery<E> queryFirst()
queryFirst in interface FeatureFetch<E>SingleQuery to fetch the first matching results with a SELECT.public SingleQuery<E> queryOne()
queryOne in interface FeatureFetch<E>SingleQuery to fetch a single unique matching result with a SELECT. The Query
execution will fail with an exception if it matches multiple result objects. It can
only have a single or an empty (null) result.Copyright © 2001–2016 mmm-Team. All rights reserved.