T - the type of the entity set that is the source of this select
statementpublic abstract class Select<T extends StructuredType<?>> extends Object implements Source<T>, CqnSelect
CdsDataStore.| Constructor and Description |
|---|
Select() |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(CqnVisitor visitor) |
abstract Select<T> |
byId(Object idValue)
Sets the where condition of the select statement, requiring that the value of
the single key element of the target entity set is equal to the given
idValue.
|
Select<T> |
columns(CqnSelectListItem... items)
Sets the projection of the select statement.
|
Select<T> |
columns(Function<T,CqnSelectListItem>... items)
Sets the projection of the select statement.
|
abstract Select<T> |
columns(List<CqnSelectListItem> items)
Sets the projection of the select statement.
|
abstract Select<T> |
columns(Stream<CqnSelectListItem> items)
Sets the projection of the select statement.
|
abstract Select<T> |
columns(String... elements)
Sets the projection of the select statement.
|
static Select<StructuredType<?>> |
copy(CqnSelect select)
|
static Select<StructuredType<?>> |
cqn(String cqnSelect)
Creates a select statement from a given CQN String.
|
abstract Select<T> |
distinct()
Specifies that duplicate query results should be eliminated.
|
abstract Select<T> |
excluding(Collection<String> qualifiedNames)
Sets the exclude list of the select statement.
|
Select<T> |
excluding(Function<T,CqnSelectListValue>... items)
Sets the exclude list of the select statement.
|
Select<T> |
excluding(String... qualifiedNames)
Sets the exclude list of the select statement.
|
static Select<StructuredType<?>> |
from(CdsEntity entity)
Creates a select statement to select entries from a specified entity set.
|
static Select<StructuredType<?>> |
from(CdsEntity entity,
UnaryOperator<StructuredType<?>> path)
Creates a select statement to select entries from a specified entity set.
|
static <R extends StructuredType<R>,T extends StructuredType<T>> |
from(Class<R> entity,
Function<R,T> path)
Creates a select statement to select entries from a specified entity set.
|
static <T extends StructuredType<T>> |
from(Class<T> entity)
Creates a select statement to select entries from a specified entity set.
|
static Select<StructuredType<?>> |
from(CqnSelect subquery)
Creates a select statement to select entries from the result of a given
subquery.
|
static Select<StructuredType<?>> |
from(CqnStructuredTypeRef ref)
Creates a select statement to select entries from a specified entity set.
|
static Select<StructuredType<?>> |
from(String qualifiedName)
Creates a select statement to select entries from a specified entity set.
|
static Select<StructuredType<?>> |
from(String entityName,
UnaryOperator<StructuredType<?>> path)
Creates a select statement to select entries from a specified entity set.
|
static <T extends StructuredType<T>> |
from(StructuredType<T> entity)
Creates a select statement to select entries from a specified entity set.
|
Select<T> |
groupBy(CqnElementRef... elements)
Sets the group by clause of the select statement.
|
Select<T> |
groupBy(Function<T,CqnSelectListItem>... items)
Sets the group by clause of the select statement.
|
abstract Select<T> |
groupBy(List<CqnSelectListItem> items)
Sets the group by clause of the select statement.
|
abstract Select<T> |
groupBy(String... elements)
Sets the groupBy clause of the select statement.
|
abstract Select<T> |
having(CqnPredicate pred)
Sets the having clause of the select statement.
|
abstract Select<T> |
having(Function<T,CqnPredicate> pred)
Sets the having clause of the select statement.
|
abstract Select<T> |
inlineCount()
Specifies that the total number of root entities matching this query shall be
returned along with the result.
|
Select<T> |
limit(Function<T,Value<Integer>> rows)
Deprecated.
instead use
limit(long rows) |
Select<T> |
limit(Function<T,Value<Integer>> rows,
Function<T,Value<Integer>> offset)
Deprecated.
instead use
limit(long rows, long offset) |
Select<T> |
limit(long rows)
Sets the limit of the select statement.
|
abstract Select<T> |
limit(long rows,
long offset)
Sets the limit and offset of the select statement.
|
abstract Select<T> |
limit(Value<Integer> rows,
Value<Integer> offset)
Deprecated.
instead use
limit(long rows, long offset) |
abstract Select<T> |
lock()
Creates a write lock on the selected rows for a default number of seconds
specified by DB so that other queries cannot lock or change the data until
current transaction is finished.
|
abstract Select<T> |
lock(int timeout)
Creates a write lock on the selected rows so that other queries cannot lock
or change the data until current transaction is finished.
|
abstract Select<T> |
matching(Map<String,?> values)
Sets the where condition of the select statement.
|
Select<T> |
orderBy(CqnSortSpecification... sortSpecs)
Sets the orderBy clause of the select statement.
|
Select<T> |
orderBy(Function<T,CqnSortSpecification>... sortSpecs)
Sets the orderBy clause of the select statement.
|
abstract Select<T> |
orderBy(List<CqnSortSpecification> sortSpecs)
Sets the orderBy clause of the select statement.
|
abstract Select<T> |
orderBy(String... elements)
Sets the orderBy clause of the select statement.
|
abstract Select<T> |
search(CqnPredicate pred)
Adds a search filter to this select statement, requiring that any searchable
element of the target entity set matches the given search predicate.
|
abstract Select<T> |
search(Function<Searchable,Predicate> pred)
Adds a search filter to this select statement, requiring that any searchable
element of the target entity set matches the given search predicate.
|
abstract Select<T> |
search(Function<Searchable,Predicate> pred,
Iterable<String> searchableElements)
Adds a search filter to this select statement, requiring that any searchable
element of the target entity set matches the given search predicate.
|
abstract Select<T> |
search(String searchTerm)
Adds a search filter to this select statement, requiring that any searchable
element of the target entity set matches the given search term
|
abstract Select<T> |
search(String searchTerm,
Iterable<String> searchableElements)
Adds a search filter to this select statement, requiring that any given
searchable element of the target entity set matches the given search term.
|
String |
toString() |
abstract Select<T> |
where(CqnPredicate pred)
Sets the where condition of the select statement.
|
abstract Select<T> |
where(Function<T,CqnPredicate> pred)
Sets the where condition of the select statement.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitasSelect, columns, excluding, from, getLock, groupBy, hasInlineCount, having, isDistinct, isSelect, search, whereasDelete, asInsert, asUpdate, asUpsert, isDelete, isInsert, isUpdate, isUpsert, reftoJsonitems, limit, orderBy, refpublic static Select<StructuredType<?>> from(String qualifiedName)
qualifiedName - the fully qualified name of the CDS entity setpublic static Select<StructuredType<?>> from(CqnStructuredTypeRef ref)
ref - the ref to the entity to select entries frompublic static <T extends StructuredType<T>> Select<T> from(StructuredType<T> entity)
T - the type of the entity setentity - the structured type representing the entity setpublic static Select<StructuredType<?>> from(String entityName, UnaryOperator<StructuredType<?>> path)
entityName - the root entity name of the path expressionpath - a path expression navigating from the root entity to the
target entity of the select statementpublic static Select<StructuredType<?>> from(CdsEntity entity)
entity - the model representation of the entity set obtained by
reflectionCdsModel.findEntity(String),
CdsModel.entities()public static Select<StructuredType<?>> from(CqnSelect subquery)
subquery - the subquery to select frompublic static Select<StructuredType<?>> from(CdsEntity entity, UnaryOperator<StructuredType<?>> path)
entity - the model representation of the entity set obtained by
reflectionpath - a path expression navigating from the root entity to the target
entity of the select statementCdsModel.findEntity(String),
CdsModel.entities()public static <T extends StructuredType<T>> Select<T> from(Class<T> entity)
T - the type of the entity setentity - the static model representation of the entity setpublic static <R extends StructuredType<R>,T extends StructuredType<T>> Select<T> from(Class<R> entity, Function<R,T> path)
R - the type of the root entityT - the type of the target entityentity - the static model representation of the entity setpath - a path expression navigating from the root entity to the target
entity of the select statementpublic static Select<StructuredType<?>> copy(CqnSelect select)
select - the CqnSelect to be copiedpublic static Select<StructuredType<?>> cqn(String cqnSelect)
cqnSelect - the CQN representation of the select statementpublic abstract Select<T> distinct()
public abstract Select<T> inlineCount()
@SafeVarargs public final Select<T> columns(CqnSelectListItem... items)
items - the CqnSelectListItem(s) that shall be
selected@SafeVarargs public final Select<T> columns(Function<T,CqnSelectListItem>... items)
items - Function(s) providing the
CqnSelectListItem(s) that shall be
selectedpublic abstract Select<T> columns(List<CqnSelectListItem> items)
items - the CqnSelectListItem(s) that shall be
selectedpublic abstract Select<T> columns(Stream<CqnSelectListItem> items)
items - the CqnSelectListItem(s) that shall be
selectedpublic abstract Select<T> columns(String... elements)
elements - the element(s) that shall be selectedpublic final Select<T> excluding(String... qualifiedNames)
qualifiedNames - the items that shall be excluded from the projection@SafeVarargs public final Select<T> excluding(Function<T,CqnSelectListValue>... items)
items - Function(s) providing the
CqnSelectListValue(s) that shall be
excluded from the projectionpublic abstract Select<T> excluding(Collection<String> qualifiedNames)
qualifiedNames - the items that shall be excluded from the projectionpublic abstract Select<T> where(Function<T,CqnPredicate> pred)
pred - a Function providing the where conditionpublic abstract Select<T> where(CqnPredicate pred)
pred - a CqnPredicatepublic abstract Select<T> matching(Map<String,?> values)
CqnParameter. The map entries are transformed into
equality predicates and joined via and.values - the element name to value map defining the where conditionpublic abstract Select<T> byId(Object idValue)
idValue - the value of the target entity's key elementpublic abstract Select<T> search(String searchTerm)
searchTerm - the value to be searched forpublic abstract Select<T> search(Function<Searchable,Predicate> pred)
pred - search predicatepublic abstract Select<T> search(CqnPredicate pred)
pred - search predicatepublic abstract Select<T> search(Function<Searchable,Predicate> pred, Iterable<String> searchableElements)
pred - search predicatesearchableElements - elements to be searched in. Overwrites default
searchable columns.public abstract Select<T> search(String searchTerm, Iterable<String> searchableElements)
searchTerm - the value to be searched forsearchableElements - elements to be searched in. Overwrites default
searchable columns.public abstract Select<T> lock(int timeout)
timeout - maximum number of seconds to wait for [timeout] seconds for
the lock acquisition, afterwards the query will fail with the
CdsLockTimemoutExceptionCdsLockTimemoutException - if a lock could not be acquiredpublic abstract Select<T> lock()
CdsLockTimemoutException is thrown.CdsLockTimemoutException - if a lock could not be acquiredpublic final Select<T> groupBy(CqnElementRef... elements)
elements - the elements the select shall be grouped by@SafeVarargs public final Select<T> groupBy(Function<T,CqnSelectListItem>... items)
items - Function(s) providing the
CqnSelectListItem(s) the select shall
be grouped bypublic abstract Select<T> groupBy(List<CqnSelectListItem> items)
items - the CqnSelectListItem(s) the select
shall be grouped bypublic abstract Select<T> groupBy(String... elements)
elements - the element(s) the select shall be grouped bypublic abstract Select<T> having(CqnPredicate pred)
pred - the having predicate conditionpublic abstract Select<T> having(Function<T,CqnPredicate> pred)
pred - Function(s) providing the having predicate
condition@SafeVarargs public final Select<T> orderBy(Function<T,CqnSortSpecification>... sortSpecs)
sortSpecs - Function(s) providing the sort
specificationpublic final Select<T> orderBy(CqnSortSpecification... sortSpecs)
sortSpecs - the sort specificationspublic abstract Select<T> orderBy(List<CqnSortSpecification> sortSpecs)
sortSpecs - the sort specificationspublic abstract Select<T> orderBy(String... elements)
elements - the elements defining the sort orderpublic Select<T> limit(long rows)
rows - the maximum number of rows returned by the querypublic abstract Select<T> limit(long rows, long offset)
rows - the maximum number of rows returned by the queryoffset - the number of rows that shall be skipped@Deprecated public final Select<T> limit(Function<T,Value<Integer>> rows, Function<T,Value<Integer>> offset)
limit(long rows, long offset)rows - Function(s) providing the maximum number of
rows returned by the queryoffset - Function(s) providing the number of rows that
shall be skipped@Deprecated public final Select<T> limit(Function<T,Value<Integer>> rows)
limit(long rows)rows - Function(s) providing the maximum number of rows
returned by the query@Deprecated public abstract Select<T> limit(Value<Integer> rows, Value<Integer> offset)
limit(long rows, long offset)rows - the maximum number of rows returned by the queryoffset - the number of rows that shall be skippedpublic void accept(CqnVisitor visitor)
Copyright © 2020 SAP. All rights reserved.