Class Query
java.lang.Object
org.springframework.data.relational.core.query.Query
Query object representing
Criteria, columns, Sort, and limit/offset for a SQL query. Query is
created with a fluent API creating immutable objects.- Since:
- 2.0
- Author:
- Mark Paluch
- See Also:
-
CriteriaSortPageable
-
Method Summary
Modifier and TypeMethodDescriptionAdd columns to the query.columns(Collection<String> columns) Add columns to the query.columns(SqlIdentifier... columns) Add columns to the query.static Queryempty()Create a new emptyQuery.Return the columns that this query should project.Return theCriteriato be applied.intgetLimit()Return the maximum number of rows to be return.longReturn the number of rows to skip.org.springframework.data.domain.SortgetSort()booleanReturn whether the query has a limit.booleanisSorted()Return true if theQueryhas a sort parameter.limit(int limit) Limit the number of returned documents tolimit.offset(long offset) Set number of rows to skip before returning results.static Queryquery(CriteriaDefinition criteria) Static factory method to create aQueryusing the providedCriteriaDefinition.sort(org.springframework.data.domain.Sort sort) Add aSortto theQueryinstance.with(org.springframework.data.domain.Pageable pageable) Set the given pagination information on theQueryinstance.
-
Method Details
-
query
Static factory method to create aQueryusing the providedCriteriaDefinition. -
empty
Create a new emptyQuery.- Returns:
-
columns
Add columns to the query.- Parameters:
columns-- Returns:
- a new
Queryobject containing the former settings withcolumnsapplied.
-
columns
Add columns to the query.- Parameters:
columns-- Returns:
- a new
Queryobject containing the former settings withcolumnsapplied.
-
columns
Add columns to the query.- Parameters:
columns-- Returns:
- a new
Queryobject containing the former settings withcolumnsapplied. - Since:
- 1.1
-
offset
Set number of rows to skip before returning results.- Parameters:
offset-- Returns:
- a new
Queryobject containing the former settings withoffsetapplied.
-
limit
Limit the number of returned documents tolimit.- Parameters:
limit-- Returns:
- a new
Queryobject containing the former settings withlimitapplied.
-
with
Set the given pagination information on theQueryinstance. Will transparently setoffsetandlimitas well as applying theSortinstance defined with thePageable.- Parameters:
pageable-- Returns:
- a new
Queryobject containing the former settings withPageableapplied.
-
sort
Add aSortto theQueryinstance.- Parameters:
sort-- Returns:
- a new
Queryobject containing the former settings withSortapplied.
-
getCriteria
Return theCriteriato be applied.- Returns:
-
getColumns
Return the columns that this query should project.- Returns:
-
isSorted
public boolean isSorted()Return true if theQueryhas a sort parameter.- Returns:
- true if sorted.
- See Also:
-
Sort.isSorted()
-
getSort
public org.springframework.data.domain.Sort getSort() -
getOffset
public long getOffset()Return the number of rows to skip.- Returns:
-
getLimit
public int getLimit()Return the maximum number of rows to be return.- Returns:
-
isLimited
public boolean isLimited()Return whether the query has a limit.- Returns:
trueif a limit is set.- Since:
- 3.0
- See Also:
-