Interface QueryMapper.MapperWhere
- All Superinterfaces:
-
QueryMapper.MapperQueryBuild
- Enclosing interface:
-
QueryMapper
Represents the step in the fluent query API where conditional
composition, pagination, ordering, or query execution can be
defined.
This interface is reached after an initial predicate has been applied and allows combining additional conditions using logical operators, configuring pagination parameters, defining result ordering, or executing the query.
@Inject
Template template;
template.select(Book.class)
.where("author").eq("Ada")
.and("publishedYear").gte(2020)
.orderBy("title").asc()
.limit(10)
.result();
The returned instance is mutable and not thread-safe. Support for
conditional composition, pagination, and ordering depends on the
capabilities of the underlying NoSQL database.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionCreate a new condition performing logical conjunction (AND) by specifying a column name.limit(long limit) Defines the maximum number of results to retrieve (pagination limit).Create a new condition performing logical disjunction (OR) by specifying a column name.Adds an ordering rule based on the specified column name.skip(long skip) Sets the number of results to skip before starting to return results.Methods inherited from interface QueryMapper.MapperQueryBuild
count, result, singleResult, stream
-
Method Details
-
and
Create a new condition performing logical conjunction (AND) by specifying a column name. Use this method to combine multiple conditions where all must be satisfied.template.select(Book.class) .where("author").eq("Ada") .and("publishedYear").gte(2020) .result();- Parameters:
name- the column name- Returns:
-
the same
QueryMapper.MapperNameConditionwith the condition appended - Throws:
-
NullPointerException- when name is null
-
or
Create a new condition performing logical disjunction (OR) by specifying a column name.template.select(Book.class) .where("author").eq("Ada") .or("author").eq("Otavio") .result();- Parameters:
name- the column name- Returns:
-
the same
QueryMapper.MapperNameConditionwith the condition appended - Throws:
-
NullPointerException- when name is null
-
skip
Sets the number of results to skip before starting to return results.template.select(Book.class) .where("category").eq("Science") .skip(10) .result();- Parameters:
-
skip- the number of results to skip - Returns:
-
the
QueryMapper.MapperSkipinstance for chaining
-
limit
Defines the maximum number of results to retrieve (pagination limit).template.select(Book.class) .where("author").eq("Ada") .limit(5);- Parameters:
limit- the limit- Returns:
- a query with the limit defined
- Throws:
-
IllegalArgumentException- when limit is negative
-
orderBy
Adds an ordering rule based on the specified column name.Use this method to define how query results should be sorted. The sort direction (ascending or descending) is specified in the subsequent step.
template.select(Book.class) .where("author").eq("Ada") .orderBy("title").asc() .result();- Parameters:
-
name- the column name to order by - Returns:
-
the
QueryMapper.MapperOrderinstance for defining the sort direction - Throws:
-
NullPointerException- when name is null
-