public class DefaultQuery extends java.lang.Object implements QueryModel
QueryModel.AvgProjection, QueryModel.Between, QueryModel.Conjunction, QueryModel.Contains, QueryModel.CountDistinctProjection, QueryModel.CountProjection, QueryModel.Criterion, QueryModel.Disjunction, QueryModel.DistinctProjection, QueryModel.DistinctPropertyProjection, QueryModel.EndsWith, QueryModel.Equals, QueryModel.EqualsAll, QueryModel.EqualsProperty, QueryModel.Exists, QueryModel.GreaterThan, QueryModel.GreaterThanAll, QueryModel.GreaterThanEquals, QueryModel.GreaterThanEqualsAll, QueryModel.GreaterThanEqualsProperty, QueryModel.GreaterThanEqualsSome, QueryModel.GreaterThanProperty, QueryModel.GreaterThanSome, QueryModel.GroupPropertyProjection, QueryModel.IdEquals, QueryModel.IdProjection, QueryModel.ILike, QueryModel.In, QueryModel.IsEmpty, QueryModel.IsFalse, QueryModel.IsNotEmpty, QueryModel.IsNotNull, QueryModel.IsNull, QueryModel.IsTrue, QueryModel.Junction, QueryModel.LessThan, QueryModel.LessThanAll, QueryModel.LessThanEquals, QueryModel.LessThanEqualsAll, QueryModel.LessThanEqualsProperty, QueryModel.LessThanEqualsSome, QueryModel.LessThanProperty, QueryModel.LessThanSome, QueryModel.Like, QueryModel.MaxProjection, QueryModel.MinProjection, QueryModel.Negation, QueryModel.NotEquals, QueryModel.NotEqualsAll, QueryModel.NotEqualsProperty, QueryModel.NotExists, QueryModel.NotIn, QueryModel.Projection, QueryModel.PropertyComparisonCriterion, QueryModel.PropertyCriterion, QueryModel.PropertyNameCriterion, QueryModel.PropertyProjection, QueryModel.RLike, QueryModel.SizeEquals, QueryModel.SizeGreaterThan, QueryModel.SizeGreaterThanEquals, QueryModel.SizeLessThan, QueryModel.SizeLessThanEquals, QueryModel.SizeNotEquals, QueryModel.StartsWith, QueryModel.SubqueryCriterion, QueryModel.SumProjection
Modifier | Constructor and Description |
---|---|
protected |
DefaultQuery(PersistentEntity entity)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
QueryModel |
add(QueryModel.Criterion criterion)
Adds the specified criterion instance to the query.
|
DefaultQuery |
allEq(java.util.Map<java.lang.String,QueryParameter> values)
Shortcut to restrict the query to multiple given property values.
|
QueryModel |
and(Criteria other)
Creates a logical conjunction.
|
DefaultQuery |
and(QueryModel.Criterion a,
QueryModel.Criterion b)
Creates a conjunction using two specified criterion.
|
DefaultQuery |
between(java.lang.String property,
QueryParameter start,
QueryParameter end)
Restricts the results by the given property value range.
|
QueryModel.Junction |
conjunction()
Creates a conjunction (AND) query.
|
QueryModel |
contains(java.lang.String propertyName,
QueryParameter parameter)
Restricts the property match to strings containing with the given value.
|
AssociationQuery |
createQuery(java.lang.String associationName)
Creates an association query.
|
QueryModel.Junction |
disjunction()
Creates a disjunction (OR) query.
|
QueryModel |
endsWith(java.lang.String propertyName,
QueryParameter parameter)
Restricts the property match to strings ending with the given value.
|
DefaultQuery |
eq(java.lang.String property,
QueryParameter parameter)
Restricts the results by the given properties value.
|
QueryModel |
eqAll(java.lang.String propertyName,
Criteria propertyValue)
Creates a subquery criterion that ensures the given property is equals to all the given returned values.
|
DefaultQuery |
eqProperty(java.lang.String propertyName,
java.lang.String otherPropertyName)
Constrains a property to be equal to a specified other property.
|
void |
forUpdate()
Lock the selected entities.
|
DefaultQuery |
ge(java.lang.String property,
QueryParameter value)
Used to restrict a value to be greater than or equal to the given value.
|
QueryModel |
geAll(java.lang.String propertyName,
Criteria propertyValue)
Creates a subquery criterion that ensures the given property is greater than or equals to all the given returned values.
|
DefaultQuery |
geProperty(java.lang.String propertyName,
java.lang.String otherPropertyName)
Constrains a property to be greater than or equal to a specified other property.
|
QueryModel |
geSome(java.lang.String propertyName,
Criteria propertyValue)
Creates a subquery criterion that ensures the given property is greater than or equal to some of the given values.
|
QueryModel.Junction |
getCriteria() |
PersistentEntity |
getEntity() |
java.util.Optional<JoinPath> |
getJoinPath(java.lang.String path)
Obtain the joint for for a given association.
|
java.util.Collection<JoinPath> |
getJoinPaths() |
int |
getMax()
Get the pageSize results to return.
|
long |
getOffset()
Get the offset of the query.
|
PersistentEntity |
getPersistentEntity() |
java.util.List<QueryModel.Projection> |
getProjections() |
Sort |
getSort()
The sort to apply.
|
DefaultQuery |
gt(java.lang.String property,
QueryParameter value)
Used to restrict a value to be greater than the given value.
|
QueryModel |
gtAll(java.lang.String propertyName,
Criteria propertyValue)
Creates a subquery criterion that ensures the given property is greater than all the given returned values.
|
DefaultQuery |
gte(java.lang.String property,
QueryParameter value)
Used to restrict a value to be greater than or equal to the given value.
|
DefaultQuery |
gtProperty(java.lang.String propertyName,
java.lang.String otherPropertyName)
Constrains a property to be greater than a specified other property.
|
QueryModel |
gtSome(java.lang.String propertyName,
Criteria propertyValue)
Creates a subquery criterion that ensures the given property is greater than some of the given values.
|
DefaultQuery |
idEq(QueryParameter value)
Restricts the results by the given properties value.
|
QueryModel |
idEquals(QueryParameter parameter)
Creates a criterion that restricts the id to the given value.
|
DefaultQuery |
ilike(java.lang.String propertyName,
QueryParameter parameter)
Creates an ilike Criterion based on the specified property name and value.
|
DefaultQuery |
inList(java.lang.String propertyName,
QueryModel subquery)
Creates an "in" Criterion using a subquery.
|
DefaultQuery |
inList(java.lang.String property,
QueryParameter values)
Restricts the results by the given property values.
|
DefaultQuery |
isEmpty(java.lang.String property)
Used to restrict a value to be empty (such as a blank string or an empty collection).
|
QueryModel |
isFalse(java.lang.String propertyName)
Creates a criterion that asserts the given property is false.
|
boolean |
isForUpdate()
Whether to lock the selected entities.
|
DefaultQuery |
isNotEmpty(java.lang.String property)
Used to restrict a value to be not empty (such as a blank string or an empty collection).
|
DefaultQuery |
isNotNull(java.lang.String property)
Used to restrict a property to be not null.
|
DefaultQuery |
isNull(java.lang.String property)
Used to restrict a property to be null.
|
QueryModel |
isTrue(java.lang.String propertyName)
Creates a criterion that asserts the given property is true.
|
JoinPath |
join(java.lang.String path,
Association association,
Join.Type joinType,
java.lang.String alias)
Specifies whether a join query should be used (if join queries are supported by the underlying datastore).
|
DefaultQuery |
le(java.lang.String property,
QueryParameter value)
Used to restrict a value to be less than or equal to the given value.
|
QueryModel |
leAll(java.lang.String propertyName,
Criteria propertyValue)
Creates a subquery criterion that ensures the given property is less than or equal to all the given returned values.
|
DefaultQuery |
leProperty(java.lang.String propertyName,
java.lang.String otherPropertyName)
Constrains a property to be less than or equal to a specified other property.
|
QueryModel |
leSome(java.lang.String propertyName,
Criteria propertyValue)
Creates a subquery criterion that ensures the given property is less than or equal to some of the given values.
|
DefaultQuery |
like(java.lang.String propertyName,
QueryParameter parameter)
Creates a like Criterion based on the specified property name and value.
|
DefaultQuery |
lt(java.lang.String property,
QueryParameter value)
Used to restrict a value to be less than the given value.
|
QueryModel |
ltAll(java.lang.String propertyName,
Criteria propertyValue)
Creates a subquery criterion that ensures the given property is less than all the given returned values.
|
DefaultQuery |
lte(java.lang.String property,
QueryParameter value)
Used to restrict a value to be less than or equal to the given value.
|
DefaultQuery |
ltProperty(java.lang.String propertyName,
java.lang.String otherPropertyName)
Constrains a property to be less than a specified other property.
|
QueryModel |
ltSome(java.lang.String propertyName,
Criteria propertyValue)
Creates a subquery criterion that ensures the given property is less than some of the given values.
|
DefaultQuery |
max(int max)
Defines the maximum number of results to return.
|
QueryModel |
ne(java.lang.String propertyName,
QueryParameter parameter)
Creates a "not equals" Criterion based on the specified property name and value.
|
QueryModel.Junction |
negation()
Creates a negation of several criterion.
|
DefaultQuery |
neProperty(java.lang.String propertyName,
java.lang.String otherPropertyName)
Constrains a property to be not equal to a specified other property.
|
QueryModel |
not(Criteria other)
Creates a logical negation.
|
DefaultQuery |
notIn(java.lang.String propertyName,
QueryModel subquery)
Creates a negated "in" Criterion using a subquery.
|
DefaultQuery |
offset(long offset)
Defines the offset (the first result index) of the query.
|
QueryModel |
or(Criteria other)
Creates a logical disjunction.
|
DefaultQuery |
or(QueryModel.Criterion a,
QueryModel.Criterion b)
Creates a disjunction using two specified criterion.
|
ProjectionList |
projections() |
DefaultQuery |
rlike(java.lang.String propertyName,
QueryParameter parameter)
Creates an rlike Criterion based on the specified property name and value.
|
DefaultQuery |
sizeEq(java.lang.String propertyName,
QueryParameter size)
Creates a Criterion that constrains a collection property by size.
|
DefaultQuery |
sizeGe(java.lang.String propertyName,
QueryParameter size)
Creates a Criterion that constrains a collection property to be greater than or equal to the given size.
|
DefaultQuery |
sizeGt(java.lang.String propertyName,
QueryParameter size)
Creates a Criterion that constrains a collection property to be greater than the given size.
|
DefaultQuery |
sizeLe(java.lang.String propertyName,
QueryParameter size)
Creates a Criterion that constrains a collection property to be less than or equal to the given size.
|
DefaultQuery |
sizeLt(java.lang.String propertyName,
QueryParameter size)
Creates a Criterion that constrains a collection property to be less than to the given size.
|
DefaultQuery |
sizeNe(java.lang.String propertyName,
QueryParameter size)
Creates a Criterion that constrains a collection property to be not equal to the given size.
|
QueryModel |
sort(Sort sort)
Apply the given sort.
|
QueryModel |
startsWith(java.lang.String propertyName,
QueryParameter parameter)
Restricts the property match to strings starting with the given value.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
from, join, join
protected DefaultQuery(@NonNull PersistentEntity entity)
entity
- The entity the query applies to.public java.util.Collection<JoinPath> getJoinPaths()
getJoinPaths
in interface QueryModel
public AssociationQuery createQuery(java.lang.String associationName)
associationName
- The assocation name@NonNull public PersistentEntity getPersistentEntity()
getPersistentEntity
in interface QueryModel
public QueryModel.Junction getCriteria()
getCriteria
in interface QueryModel
@NonNull public java.util.List<QueryModel.Projection> getProjections()
getProjections
in interface QueryModel
public java.util.Optional<JoinPath> getJoinPath(java.lang.String path)
getJoinPath
in interface QueryModel
path
- The path to the associationpublic JoinPath join(@NonNull java.lang.String path, @NonNull Association association, @NonNull Join.Type joinType, java.lang.String alias)
join
in interface QueryModel
association
- The propertypath
- The join pathjoinType
- The join typealias
- The alias to use.public ProjectionList projections()
projections
in interface QueryModel
@NonNull public QueryModel add(@NonNull QueryModel.Criterion criterion)
add
in interface QueryModel
criterion
- The criterion instancepublic PersistentEntity getEntity()
public QueryModel.Junction disjunction()
public QueryModel.Junction conjunction()
public QueryModel.Junction negation()
public DefaultQuery max(int max)
max
in interface QueryModel
max
- The pageSize resultspublic int getMax()
QueryModel
getMax
in interface QueryModel
public long getOffset()
QueryModel
getOffset
in interface QueryModel
public void forUpdate()
QueryModel
forUpdate
in interface QueryModel
public boolean isForUpdate()
QueryModel
isForUpdate
in interface QueryModel
public DefaultQuery offset(long offset)
offset
in interface QueryModel
offset
- The offsetpublic Sort getSort()
QueryModel
getSort
in interface QueryModel
@NonNull public QueryModel sort(@NonNull Sort sort)
QueryModel
sort
in interface QueryModel
sort
- The sort to apply@NonNull public DefaultQuery eq(@NonNull java.lang.String property, @NonNull QueryParameter parameter)
eq
in interface Criteria
eq
in interface QueryModel
property
- The name of the propertyparameter
- The parameter that provides the value@NonNull public DefaultQuery allEq(@NonNull java.util.Map<java.lang.String,QueryParameter> values)
allEq
in interface Criteria
allEq
in interface QueryModel
values
- The values@NonNull public QueryModel eqAll(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
Criteria
eqAll
in interface Criteria
eqAll
in interface QueryModel
propertyName
- The property namepropertyValue
- A subquery@NonNull public QueryModel gtAll(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
Criteria
gtAll
in interface Criteria
gtAll
in interface QueryModel
propertyName
- The property namepropertyValue
- A subquery@NonNull public QueryModel ltAll(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
Criteria
ltAll
in interface Criteria
ltAll
in interface QueryModel
propertyName
- The property namepropertyValue
- A subquery@NonNull public QueryModel geAll(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
Criteria
geAll
in interface Criteria
geAll
in interface QueryModel
propertyName
- The property namepropertyValue
- A subquery@NonNull public QueryModel leAll(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
Criteria
leAll
in interface Criteria
leAll
in interface QueryModel
propertyName
- The property namepropertyValue
- A subquery@NonNull public QueryModel gtSome(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
Criteria
gtSome
in interface Criteria
gtSome
in interface QueryModel
propertyName
- The property namepropertyValue
- The property value@NonNull public QueryModel geSome(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
Criteria
geSome
in interface Criteria
geSome
in interface QueryModel
propertyName
- The property namepropertyValue
- The property value@NonNull public QueryModel ltSome(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
Criteria
ltSome
in interface Criteria
ltSome
in interface QueryModel
propertyName
- The property namepropertyValue
- The property value@NonNull public QueryModel leSome(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
Criteria
leSome
in interface Criteria
leSome
in interface QueryModel
propertyName
- The property namepropertyValue
- The property value@NonNull public QueryModel idEquals(QueryParameter parameter)
Criteria
idEquals
in interface Criteria
idEquals
in interface QueryModel
parameter
- The parameter that provides the value@NonNull public DefaultQuery isEmpty(@NonNull java.lang.String property)
isEmpty
in interface Criteria
isEmpty
in interface QueryModel
property
- The property name@NonNull public DefaultQuery isNotEmpty(@NonNull java.lang.String property)
isNotEmpty
in interface Criteria
isNotEmpty
in interface QueryModel
property
- The property name@NonNull public DefaultQuery isNull(@NonNull java.lang.String property)
isNull
in interface Criteria
isNull
in interface QueryModel
property
- The property name@NonNull public QueryModel isTrue(@NonNull java.lang.String propertyName)
Criteria
isTrue
in interface Criteria
isTrue
in interface QueryModel
propertyName
- The property name@NonNull public QueryModel isFalse(@NonNull java.lang.String propertyName)
Criteria
isFalse
in interface Criteria
isFalse
in interface QueryModel
propertyName
- The property name@NonNull public DefaultQuery isNotNull(@NonNull java.lang.String property)
isNotNull
in interface Criteria
isNotNull
in interface QueryModel
property
- The property name@NonNull public DefaultQuery idEq(@NonNull QueryParameter value)
idEq
in interface Criteria
idEq
in interface QueryModel
value
- The value to restrict by@NonNull public QueryModel ne(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
Criteria
ne
in interface Criteria
ne
in interface QueryModel
propertyName
- The property nameparameter
- The parameter that provides the value@NonNull public DefaultQuery gt(@NonNull java.lang.String property, @NonNull QueryParameter value)
gt
in interface Criteria
gt
in interface QueryModel
property
- The name of the propertyvalue
- The value to restrict bypublic DefaultQuery gte(java.lang.String property, QueryParameter value)
gte
in interface Criteria
gte
in interface QueryModel
property
- The name of the propertyvalue
- The value to restrict bypublic DefaultQuery lte(java.lang.String property, QueryParameter value)
lte
in interface Criteria
lte
in interface QueryModel
property
- The name of the propertyvalue
- The value to restrict bypublic DefaultQuery ge(java.lang.String property, QueryParameter value)
ge
in interface Criteria
ge
in interface QueryModel
property
- The name of the propertyvalue
- The value to restrict bypublic DefaultQuery le(java.lang.String property, QueryParameter value)
le
in interface Criteria
le
in interface QueryModel
property
- The name of the propertyvalue
- The value to restrict bypublic DefaultQuery lt(java.lang.String property, QueryParameter value)
lt
in interface Criteria
lt
in interface QueryModel
property
- The name of the propertyvalue
- The value to restrict by@NonNull public DefaultQuery like(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
Criteria
like
in interface Criteria
like
in interface QueryModel
propertyName
- The property nameparameter
- The parameter that provides the value@NonNull public QueryModel startsWith(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
Criteria
startsWith
in interface Criteria
startsWith
in interface QueryModel
propertyName
- The property nameparameter
- The parameter that provides the value@NonNull public QueryModel endsWith(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
Criteria
endsWith
in interface Criteria
endsWith
in interface QueryModel
propertyName
- The property nameparameter
- The parameter that provides the value@NonNull public QueryModel contains(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
Criteria
contains
in interface Criteria
contains
in interface QueryModel
propertyName
- The property nameparameter
- The parameter that provides the value@NonNull public DefaultQuery ilike(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
Criteria
ilike
in interface Criteria
ilike
in interface QueryModel
propertyName
- The property nameparameter
- The parameter that provides the value@NonNull public DefaultQuery rlike(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
Criteria
rlike
in interface Criteria
rlike
in interface QueryModel
propertyName
- The property nameparameter
- The parameter that provides the value@NonNull public QueryModel and(@NonNull Criteria other)
Criteria
and
in interface Criteria
and
in interface QueryModel
other
- The other criteria@NonNull public QueryModel or(@NonNull Criteria other)
Criteria
or
in interface Criteria
or
in interface QueryModel
other
- The other criteria@NonNull public QueryModel not(@NonNull Criteria other)
Criteria
not
in interface Criteria
not
in interface QueryModel
other
- The other criteria@NonNull public DefaultQuery inList(@NonNull java.lang.String propertyName, @NonNull QueryModel subquery)
Criteria
inList
in interface Criteria
inList
in interface QueryModel
propertyName
- The property namesubquery
- The subquerypublic DefaultQuery inList(java.lang.String property, QueryParameter values)
inList
in interface Criteria
inList
in interface QueryModel
property
- The name of the propertyvalues
- The values to restrict by@NonNull public DefaultQuery notIn(@NonNull java.lang.String propertyName, @NonNull QueryModel subquery)
Criteria
notIn
in interface Criteria
notIn
in interface QueryModel
propertyName
- The property namesubquery
- The subquery@NonNull public DefaultQuery sizeEq(@NonNull java.lang.String propertyName, @NonNull QueryParameter size)
Criteria
sizeEq
in interface Criteria
sizeEq
in interface QueryModel
propertyName
- The property namesize
- The size to constrain by@NonNull public DefaultQuery sizeGt(@NonNull java.lang.String propertyName, @NonNull QueryParameter size)
Criteria
sizeGt
in interface Criteria
sizeGt
in interface QueryModel
propertyName
- The property namesize
- The size to constrain by@NonNull public DefaultQuery sizeGe(@NonNull java.lang.String propertyName, @NonNull QueryParameter size)
Criteria
sizeGe
in interface Criteria
sizeGe
in interface QueryModel
propertyName
- The property namesize
- The size to constrain by@NonNull public DefaultQuery sizeLe(@NonNull java.lang.String propertyName, @NonNull QueryParameter size)
Criteria
sizeLe
in interface Criteria
sizeLe
in interface QueryModel
propertyName
- The property namesize
- The size to constrain by@NonNull public DefaultQuery sizeLt(@NonNull java.lang.String propertyName, @NonNull QueryParameter size)
Criteria
sizeLt
in interface Criteria
sizeLt
in interface QueryModel
propertyName
- The property namesize
- The size to constrain by@NonNull public DefaultQuery sizeNe(@NonNull java.lang.String propertyName, @NonNull QueryParameter size)
Criteria
sizeNe
in interface Criteria
sizeNe
in interface QueryModel
propertyName
- The property namesize
- The size to constrain by@NonNull public DefaultQuery eqProperty(@NonNull java.lang.String propertyName, @NonNull java.lang.String otherPropertyName)
Criteria
eqProperty
in interface Criteria
eqProperty
in interface QueryModel
propertyName
- The propertyotherPropertyName
- The other property@NonNull public DefaultQuery neProperty(@NonNull java.lang.String propertyName, @NonNull java.lang.String otherPropertyName)
Criteria
neProperty
in interface Criteria
neProperty
in interface QueryModel
propertyName
- The propertyotherPropertyName
- The other property@NonNull public DefaultQuery gtProperty(@NonNull java.lang.String propertyName, @NonNull java.lang.String otherPropertyName)
Criteria
gtProperty
in interface Criteria
gtProperty
in interface QueryModel
propertyName
- The propertyotherPropertyName
- The other property@NonNull public DefaultQuery geProperty(@NonNull java.lang.String propertyName, @NonNull java.lang.String otherPropertyName)
Criteria
geProperty
in interface Criteria
geProperty
in interface QueryModel
propertyName
- The propertyotherPropertyName
- The other property@NonNull public DefaultQuery ltProperty(@NonNull java.lang.String propertyName, @NonNull java.lang.String otherPropertyName)
Criteria
ltProperty
in interface Criteria
ltProperty
in interface QueryModel
propertyName
- The propertyotherPropertyName
- The other property@NonNull public DefaultQuery leProperty(java.lang.String propertyName, @NonNull java.lang.String otherPropertyName)
Criteria
leProperty
in interface Criteria
leProperty
in interface QueryModel
propertyName
- The propertyotherPropertyName
- The other propertypublic DefaultQuery between(java.lang.String property, QueryParameter start, QueryParameter end)
between
in interface Criteria
between
in interface QueryModel
property
- The name of the propertystart
- The start of the rangeend
- The end of the rangepublic DefaultQuery and(QueryModel.Criterion a, QueryModel.Criterion b)
a
- The left hand sideb
- The right hand sidepublic DefaultQuery or(QueryModel.Criterion a, QueryModel.Criterion b)
a
- The left hand sideb
- The right hand side