Package io.micronaut.data.model.query
Interface QueryModel
- All Superinterfaces:
Criteria
- All Known Implementing Classes:
AssociationQuery
,DefaultQuery
Main interface for constructing queries at either compilation or runtime.
- Since:
- 1.0
- Author:
- graemerocher
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
Criterion used to restrict the results based on belonging to an array.static class
Computes the average value of a property.static class
Criterion used to restrict the result to be between values (range query).static class
A Criterion used to combine to criterion in a logical AND.static class
Criterion used to restrict the results based on a result containing the given value.static class
Projection to count distinct property names.static class
Used to count the results of a query.static interface
Represents a criterion to be used in a criteria query.static class
A Criterion used to combine to criterion in a logical OR.static class
Distinct result projection.static class
Projection to return distinct property names.static class
Criterion used to restrict the results based on starting with a given value.static class
A criterion that restricts the results based on equality.static class
Restricts a value to be equal to all the given values.static class
A criterion for one property equaling another.static class
Used for exists subquery.static class
Used to restrict a value to be greater than the given value.static class
Restricts a value to be greater than all the given values.static class
Used to restrict a value to be greater than or equal to the given value.static class
Restricts a value to be greater than or equal to all the given values.static class
A criterion for one property being greater than or equal to another.static class
Restricts a value to be greater than some of the given values.static class
A criterion for one property being greater than another.static class
Restricts a value to be greater than some of the given values.static class
Group by property projection.static class
A criterion that restricts the results based on the equality of the identifier.static class
A projection used to obtain the identifier of an object.static class
Criterion used to restrict the results based on a pattern (likeness).static class
Criterion used to restrict the results based on a list of values.static class
Restricts a property to be empty (such as a blank string).static class
Restricts a property to be false.static class
Restricts a property to be empty (such as a blank string).static class
Restricts a property to be not null.static class
Restricts a property to be null.static class
Restricts a property to be true.static class
base class for a junction (AND or OR or NOT).static class
Used to restrict a value to be less than the given value.static class
Restricts a value to be less than all the given values.static class
Used to restrict a value to be less than the given value.static class
Restricts a value to be less than or equal to all the given values.static class
A criterion for one property being less than or equal to another.static class
Restricts a value to be less than some of the given values.static class
A criterion for one property being less than another.static class
Restricts a value to be less than some of the given values.static class
Criterion used to restrict the results based on a pattern (likeness).static class
A projection of a simple literal.static class
Computes the pageSize value of a property.static class
Computes the min value of a property.static class
A criterion used to negate several other criterion.static class
A criterion that restricts the results based on equality.static class
Restricts a value to be not equal to all the given values.static class
A criterion for one property not equaling another.static class
Used for exists subquery.static class
Criterion used to restrict the results based on a list of values.static class
A projection.static class
A Criterion that compares to properties.static class
Criterion that applies to a property and value.static class
A Criterion that applies to a property.static class
A projection that obtains the value of a property of an entity.static class
Criterion used to restrict the results based on a regex pattern.static class
Criterion used to restrict the results based on a regular expression pattern.static class
Size equals criterion.static class
Size greater than criterion.static class
Size greater than equals criterion.static class
Size less than criterion.static class
Size less than equals criterion.static class
Size not equals criterion.static class
Criterion used to restrict the results based on starting with a given value.static class
Used to differentiate criterion that require a subquery.static class
Computes the sum of a property.static class
A criterion that restricts the results based on the equality of the version. -
Method Summary
Modifier and TypeMethodDescriptionadd
(QueryModel.Criterion criterion) Adds the specified criterion instance to the query.Apply an "equals" constraint to each property in the key set of aMap
.Creates a logical conjunction.Restricts the results by the given property value range (inclusive).Restricts the property match to strings containing with the given value.Restricts the property match to strings ending with the given value.Creates an "equals" Criterion based on the specified property name and value.Creates a subquery criterion that ensures the given property is equals to all the given returned values.eqProperty
(String propertyName, String otherPropertyName) Constrains a property to be equal to a specified other property.void
Lock the selected entities.static QueryModel
from
(PersistentEntity entity) Creates a query from the given entity.Used to restrict a value to be greater than or equal to the given value.Creates a subquery criterion that ensures the given property is greater than or equals to all the given returned values.geProperty
(String propertyName, String otherPropertyName) Constrains a property to be greater than or equal to a specified other property.Creates a subquery criterion that ensures the given property is greater than or equal to some of the given values.getJoinPath
(String path) Obtain the join type for the given association.int
getMax()
Get the pageSize results to return.long
Get the offset of the query.default Sort
getSort()
The sort to apply.Used to restrict a value to be greater than or equal to the given value.Creates a subquery criterion that ensures the given property is greater than all the given returned values.Used to restrict a value to be greater than or equal to the given value.gtProperty
(String propertyName, String otherPropertyName) Constrains a property to be greater than a specified other property.Creates a subquery criterion that ensures the given property is greater than some of the given values.Creates an "equals" Criterion based on the specified property name and value.Creates an ilike Criterion based on the specified property name and value.inList
(String propertyName, QueryModel subquery) Creates an "in" Criterion using a subquery.Creates an "in" Criterion based on the specified property name and list of values.Creates a criterion that asserts the given property is empty (such as a blank string).Creates a criterion that asserts the given property is false.boolean
Whether to lock the selected entities.isNotEmpty
(String propertyName) Creates a criterion that asserts the given property is not empty.Creates a criterion that asserts the given property is not null.Creates a criterion that asserts the given property is null.Creates a criterion that asserts the given property is true.default JoinPath
join
(Association association) Join on the given association.default JoinPath
join
(Association association, Join.Type joinType) Join on the given association.Join on the given association.join
(String path, Association association, Join.Type joinType, String alias) Deprecated.Used to restrict a value to be less than or equal to the given value.Creates a subquery criterion that ensures the given property is less than or equal to all the given returned values.leProperty
(String propertyName, String otherPropertyName) Constrains a property to be less than or equal to a specified other property.Creates a subquery criterion that ensures the given property is less than or equal to some of the given values.Creates a like Criterion based on the specified property name and value.Used to restrict a value to be less than or equal to the given value.Creates a subquery criterion that ensures the given property is less than all the given returned values.Used to restrict a value to be less than or equal to the given value.ltProperty
(String propertyName, String otherPropertyName) Constrains a property to be less than a specified other property.Creates a subquery criterion that ensures the given property is less than some of the given values.max
(int max) Limits the maximum result.Creates a "not equals" Criterion based on the specified property name and value.neProperty
(String propertyName, String otherPropertyName) Constrains a property to be not equal to a specified other property.Creates a logical negation.notIn
(String propertyName, QueryModel subquery) Creates a negated "in" Criterion using a subquery.offset
(long offset) Sets the offset.Creates a logical disjunction.Creates an rlike Criterion based on the specified property name and value.Creates a Criterion that constrains a collection property by size.Creates a Criterion that constrains a collection property to be greater than or equal to the given size.Creates a Criterion that constrains a collection property to be greater than the given size.Creates a Criterion that constrains a collection property to be less than or equal to the given size.Creates a Criterion that constrains a collection property to be less than to the given size.Creates a Criterion that constrains a collection property to be not equal to the given size.Apply the given sort.startsWith
(String propertyName, Object parameter) Restricts the property match to strings starting with the given value.Creates that restricts the version to the given value.
-
Method Details
-
idEq
Description copied from interface:Criteria
Creates an "equals" Criterion based on the specified property name and value. -
versionEq
Description copied from interface:Criteria
Creates that restricts the version to the given value. -
isEmpty
Description copied from interface:Criteria
Creates a criterion that asserts the given property is empty (such as a blank string). -
isNotEmpty
Description copied from interface:Criteria
Creates a criterion that asserts the given property is not empty.- Specified by:
isNotEmpty
in interfaceCriteria
- Parameters:
propertyName
- The property name- Returns:
- The criteria
-
isNull
Description copied from interface:Criteria
Creates a criterion that asserts the given property is null. -
isTrue
Description copied from interface:Criteria
Creates a criterion that asserts the given property is true. -
isFalse
Description copied from interface:Criteria
Creates a criterion that asserts the given property is false. -
isNotNull
Description copied from interface:Criteria
Creates a criterion that asserts the given property is not null. -
eq
Description copied from interface:Criteria
Creates an "equals" Criterion based on the specified property name and value. -
ne
Description copied from interface:Criteria
Creates a "not equals" Criterion based on the specified property name and value. -
between
@NonNull QueryModel between(@NonNull String propertyName, @NonNull Object start, @NonNull Object finish) Description copied from interface:Criteria
Restricts the results by the given property value range (inclusive). -
gte
Description copied from interface:Criteria
Used to restrict a value to be greater than or equal to the given value. -
ge
Description copied from interface:Criteria
Used to restrict a value to be greater than or equal to the given value. -
gt
Description copied from interface:Criteria
Used to restrict a value to be greater than or equal to the given value. -
lte
Description copied from interface:Criteria
Used to restrict a value to be less than or equal to the given value. -
le
Description copied from interface:Criteria
Used to restrict a value to be less than or equal to the given value. -
lt
Description copied from interface:Criteria
Used to restrict a value to be less than or equal to the given value. -
like
Description copied from interface:Criteria
Creates a like Criterion based on the specified property name and value. -
startsWith
Description copied from interface:Criteria
Restricts the property match to strings starting with the given value.- Specified by:
startsWith
in interfaceCriteria
- Parameters:
propertyName
- The property nameparameter
- The parameter that provides the value- Returns:
- The criteria
-
endsWith
Description copied from interface:Criteria
Restricts the property match to strings ending with the given value. -
contains
Description copied from interface:Criteria
Restricts the property match to strings containing with the given value. -
ilike
Description copied from interface:Criteria
Creates an ilike Criterion based on the specified property name and value. Unlike a like condition, ilike is case insensitive. -
rlike
Description copied from interface:Criteria
Creates an rlike Criterion based on the specified property name and value. -
and
Description copied from interface:Criteria
Creates a logical conjunction. -
or
Description copied from interface:Criteria
Creates a logical disjunction. -
not
Description copied from interface:Criteria
Creates a logical negation. -
inList
Description copied from interface:Criteria
Creates an "in" Criterion using a subquery. -
inList
Description copied from interface:Criteria
Creates an "in" Criterion based on the specified property name and list of values. -
notIn
Description copied from interface:Criteria
Creates a negated "in" Criterion using a subquery. -
sizeEq
Description copied from interface:Criteria
Creates a Criterion that constrains a collection property by size. -
sizeGt
Description copied from interface:Criteria
Creates a Criterion that constrains a collection property to be greater than the given size. -
sizeGe
Description copied from interface:Criteria
Creates a Criterion that constrains a collection property to be greater than or equal to the given size. -
sizeLe
Description copied from interface:Criteria
Creates a Criterion that constrains a collection property to be less than or equal to the given size. -
sizeLt
Description copied from interface:Criteria
Creates a Criterion that constrains a collection property to be less than to the given size. -
sizeNe
Description copied from interface:Criteria
Creates a Criterion that constrains a collection property to be not equal to the given size. -
eqProperty
Description copied from interface:Criteria
Constrains a property to be equal to a specified other property.- Specified by:
eqProperty
in interfaceCriteria
- Parameters:
propertyName
- The propertyotherPropertyName
- The other property- Returns:
- This criteria
-
neProperty
Description copied from interface:Criteria
Constrains a property to be not equal to a specified other property.- Specified by:
neProperty
in interfaceCriteria
- Parameters:
propertyName
- The propertyotherPropertyName
- The other property- Returns:
- This criteria
-
gtProperty
Description copied from interface:Criteria
Constrains a property to be greater than a specified other property.- Specified by:
gtProperty
in interfaceCriteria
- Parameters:
propertyName
- The propertyotherPropertyName
- The other property- Returns:
- This criteria
-
geProperty
Description copied from interface:Criteria
Constrains a property to be greater than or equal to a specified other property.- Specified by:
geProperty
in interfaceCriteria
- Parameters:
propertyName
- The propertyotherPropertyName
- The other property- Returns:
- This criteria
-
ltProperty
Description copied from interface:Criteria
Constrains a property to be less than a specified other property.- Specified by:
ltProperty
in interfaceCriteria
- Parameters:
propertyName
- The propertyotherPropertyName
- The other property- Returns:
- This criteria
-
leProperty
Description copied from interface:Criteria
Constrains a property to be less than or equal to a specified other property.- Specified by:
leProperty
in interfaceCriteria
- Parameters:
propertyName
- The propertyotherPropertyName
- The other property- Returns:
- This criteria
-
allEq
Description copied from interface:Criteria
Apply an "equals" constraint to each property in the key set of aMap
. -
eqAll
Description copied from interface:Criteria
Creates a subquery criterion that ensures the given property is equals to all the given returned values. -
gtAll
Description copied from interface:Criteria
Creates a subquery criterion that ensures the given property is greater than all the given returned values. -
ltAll
Description copied from interface:Criteria
Creates a subquery criterion that ensures the given property is less than all the given returned values. -
geAll
Description copied from interface:Criteria
Creates a subquery criterion that ensures the given property is greater than or equals to all the given returned values. -
leAll
Description copied from interface:Criteria
Creates a subquery criterion that ensures the given property is less than or equal to all the given returned values. -
gtSome
Description copied from interface:Criteria
Creates a subquery criterion that ensures the given property is greater than some of the given values. -
geSome
Description copied from interface:Criteria
Creates a subquery criterion that ensures the given property is greater than or equal to some of the given values. -
ltSome
Description copied from interface:Criteria
Creates a subquery criterion that ensures the given property is less than some of the given values. -
leSome
Description copied from interface:Criteria
Creates a subquery criterion that ensures the given property is less than or equal to some of the given values. -
getJoinPaths
Collection<JoinPath> getJoinPaths()- Returns:
- The join paths.
-
getPersistentEntity
- Returns:
- The entity the criteria applies to
-
getCriteria
- Returns:
- The criteria for this query
-
getProjections
- Returns:
- The projections that apply to this query.
-
getJoinPath
Obtain the join type for the given association.- Parameters:
path
- The path- Returns:
- The join type for the association.
-
join
@NonNull @Deprecated JoinPath join(String path, Association association, @NonNull Join.Type joinType, @Nullable String alias) Deprecated.Join on the given association.- Parameters:
path
- The join pathassociation
- The associationjoinType
- The join typealias
- The alias to use.- Returns:
- The query
-
join
Join on the given association.- Parameters:
path
- The join pathjoinType
- The join typealias
- The alias to use.- Returns:
- The query
-
join
Join on the given association.- Parameters:
association
- The association, never nulljoinType
- The join type- Returns:
- The query
-
join
Join on the given association.- Parameters:
association
- The association, never null- Returns:
- The query
-
projections
- Returns:
- The projection list.
-
add
Adds the specified criterion instance to the query.- Parameters:
criterion
- The criterion instance- Returns:
- This query
-
max
Limits the maximum result.- Parameters:
max
- The pageSize- Returns:
- This query
-
offset
Sets the offset.- Parameters:
offset
- The offset- Returns:
- This query
-
getSort
The sort to apply.- Returns:
- The sort
-
sort
Apply the given sort.- Parameters:
sort
- The sort to apply- Returns:
- This query
-
from
Creates a query from the given entity.- Parameters:
entity
- The entity- Returns:
- The query
-
getMax
int getMax()Get the pageSize results to return.- Returns:
- The pageSize results
-
getOffset
long getOffset()Get the offset of the query.- Returns:
- The offset
-
forUpdate
void forUpdate()Lock the selected entities. -
isForUpdate
boolean isForUpdate()Whether to lock the selected entities.- Returns:
- true if the the selected entities should be locked
-