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, waitfrom, join, joinprotected DefaultQuery(@NonNull
PersistentEntity entity)
entity - The entity the query applies to.public java.util.Collection<JoinPath> getJoinPaths()
getJoinPaths in interface QueryModelpublic AssociationQuery createQuery(java.lang.String associationName)
associationName - The assocation name@NonNull public PersistentEntity getPersistentEntity()
getPersistentEntity in interface QueryModelpublic QueryModel.Junction getCriteria()
getCriteria in interface QueryModel@NonNull public java.util.List<QueryModel.Projection> getProjections()
getProjections in interface QueryModelpublic java.util.Optional<JoinPath> getJoinPath(java.lang.String path)
getJoinPath in interface QueryModelpath - 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 QueryModelassociation - 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 QueryModelcriterion - 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 QueryModelmax - The pageSize resultspublic int getMax()
QueryModelgetMax in interface QueryModelpublic long getOffset()
QueryModelgetOffset in interface QueryModelpublic void forUpdate()
QueryModelforUpdate in interface QueryModelpublic boolean isForUpdate()
QueryModelisForUpdate in interface QueryModelpublic DefaultQuery offset(long offset)
offset in interface QueryModeloffset - The offsetpublic Sort getSort()
QueryModelgetSort in interface QueryModel@NonNull public QueryModel sort(@NonNull Sort sort)
QueryModelsort in interface QueryModelsort - The sort to apply@NonNull public DefaultQuery eq(@NonNull java.lang.String property, @NonNull QueryParameter parameter)
eq in interface Criteriaeq in interface QueryModelproperty - 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 CriteriaallEq in interface QueryModelvalues - The values@NonNull public QueryModel eqAll(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
CriteriaeqAll in interface CriteriaeqAll in interface QueryModelpropertyName - The property namepropertyValue - A subquery@NonNull public QueryModel gtAll(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
CriteriagtAll in interface CriteriagtAll in interface QueryModelpropertyName - The property namepropertyValue - A subquery@NonNull public QueryModel ltAll(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
CriterialtAll in interface CriterialtAll in interface QueryModelpropertyName - The property namepropertyValue - A subquery@NonNull public QueryModel geAll(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
CriteriageAll in interface CriteriageAll in interface QueryModelpropertyName - The property namepropertyValue - A subquery@NonNull public QueryModel leAll(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
CriterialeAll in interface CriterialeAll in interface QueryModelpropertyName - The property namepropertyValue - A subquery@NonNull public QueryModel gtSome(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
CriteriagtSome in interface CriteriagtSome in interface QueryModelpropertyName - The property namepropertyValue - The property value@NonNull public QueryModel geSome(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
CriteriageSome in interface CriteriageSome in interface QueryModelpropertyName - The property namepropertyValue - The property value@NonNull public QueryModel ltSome(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
CriterialtSome in interface CriterialtSome in interface QueryModelpropertyName - The property namepropertyValue - The property value@NonNull public QueryModel leSome(@NonNull java.lang.String propertyName, @NonNull Criteria propertyValue)
CriterialeSome in interface CriterialeSome in interface QueryModelpropertyName - The property namepropertyValue - The property value@NonNull public QueryModel idEquals(QueryParameter parameter)
CriteriaidEquals in interface CriteriaidEquals in interface QueryModelparameter - The parameter that provides the value@NonNull public DefaultQuery isEmpty(@NonNull java.lang.String property)
isEmpty in interface CriteriaisEmpty in interface QueryModelproperty - The property name@NonNull public DefaultQuery isNotEmpty(@NonNull java.lang.String property)
isNotEmpty in interface CriteriaisNotEmpty in interface QueryModelproperty - The property name@NonNull public DefaultQuery isNull(@NonNull java.lang.String property)
isNull in interface CriteriaisNull in interface QueryModelproperty - The property name@NonNull public QueryModel isTrue(@NonNull java.lang.String propertyName)
CriteriaisTrue in interface CriteriaisTrue in interface QueryModelpropertyName - The property name@NonNull public QueryModel isFalse(@NonNull java.lang.String propertyName)
CriteriaisFalse in interface CriteriaisFalse in interface QueryModelpropertyName - The property name@NonNull public DefaultQuery isNotNull(@NonNull java.lang.String property)
isNotNull in interface CriteriaisNotNull in interface QueryModelproperty - The property name@NonNull public DefaultQuery idEq(@NonNull QueryParameter value)
idEq in interface CriteriaidEq in interface QueryModelvalue - The value to restrict by@NonNull public QueryModel ne(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
Criteriane in interface Criteriane in interface QueryModelpropertyName - The property nameparameter - The parameter that provides the value@NonNull public DefaultQuery gt(@NonNull java.lang.String property, @NonNull QueryParameter value)
gt in interface Criteriagt in interface QueryModelproperty - The name of the propertyvalue - The value to restrict bypublic DefaultQuery gte(java.lang.String property, QueryParameter value)
gte in interface Criteriagte in interface QueryModelproperty - The name of the propertyvalue - The value to restrict bypublic DefaultQuery lte(java.lang.String property, QueryParameter value)
lte in interface Criterialte in interface QueryModelproperty - The name of the propertyvalue - The value to restrict bypublic DefaultQuery ge(java.lang.String property, QueryParameter value)
ge in interface Criteriage in interface QueryModelproperty - The name of the propertyvalue - The value to restrict bypublic DefaultQuery le(java.lang.String property, QueryParameter value)
le in interface Criteriale in interface QueryModelproperty - The name of the propertyvalue - The value to restrict bypublic DefaultQuery lt(java.lang.String property, QueryParameter value)
lt in interface Criterialt in interface QueryModelproperty - The name of the propertyvalue - The value to restrict by@NonNull public DefaultQuery like(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
Criterialike in interface Criterialike in interface QueryModelpropertyName - The property nameparameter - The parameter that provides the value@NonNull public QueryModel startsWith(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
CriteriastartsWith in interface CriteriastartsWith in interface QueryModelpropertyName - The property nameparameter - The parameter that provides the value@NonNull public QueryModel endsWith(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
CriteriaendsWith in interface CriteriaendsWith in interface QueryModelpropertyName - The property nameparameter - The parameter that provides the value@NonNull public QueryModel contains(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
Criteriacontains in interface Criteriacontains in interface QueryModelpropertyName - The property nameparameter - The parameter that provides the value@NonNull public DefaultQuery ilike(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
Criteriailike in interface Criteriailike in interface QueryModelpropertyName - The property nameparameter - The parameter that provides the value@NonNull public DefaultQuery rlike(@NonNull java.lang.String propertyName, @NonNull QueryParameter parameter)
Criteriarlike in interface Criteriarlike in interface QueryModelpropertyName - The property nameparameter - The parameter that provides the value@NonNull public QueryModel and(@NonNull Criteria other)
Criteriaand in interface Criteriaand in interface QueryModelother - The other criteria@NonNull public QueryModel or(@NonNull Criteria other)
Criteriaor in interface Criteriaor in interface QueryModelother - The other criteria@NonNull public QueryModel not(@NonNull Criteria other)
Criterianot in interface Criterianot in interface QueryModelother - The other criteria@NonNull public DefaultQuery inList(@NonNull java.lang.String propertyName, @NonNull QueryModel subquery)
CriteriainList in interface CriteriainList in interface QueryModelpropertyName - The property namesubquery - The subquerypublic DefaultQuery inList(java.lang.String property, QueryParameter values)
inList in interface CriteriainList in interface QueryModelproperty - The name of the propertyvalues - The values to restrict by@NonNull public DefaultQuery notIn(@NonNull java.lang.String propertyName, @NonNull QueryModel subquery)
CriterianotIn in interface CriterianotIn in interface QueryModelpropertyName - The property namesubquery - The subquery@NonNull public DefaultQuery sizeEq(@NonNull java.lang.String propertyName, @NonNull QueryParameter size)
CriteriasizeEq in interface CriteriasizeEq in interface QueryModelpropertyName - The property namesize - The size to constrain by@NonNull public DefaultQuery sizeGt(@NonNull java.lang.String propertyName, @NonNull QueryParameter size)
CriteriasizeGt in interface CriteriasizeGt in interface QueryModelpropertyName - The property namesize - The size to constrain by@NonNull public DefaultQuery sizeGe(@NonNull java.lang.String propertyName, @NonNull QueryParameter size)
CriteriasizeGe in interface CriteriasizeGe in interface QueryModelpropertyName - The property namesize - The size to constrain by@NonNull public DefaultQuery sizeLe(@NonNull java.lang.String propertyName, @NonNull QueryParameter size)
CriteriasizeLe in interface CriteriasizeLe in interface QueryModelpropertyName - The property namesize - The size to constrain by@NonNull public DefaultQuery sizeLt(@NonNull java.lang.String propertyName, @NonNull QueryParameter size)
CriteriasizeLt in interface CriteriasizeLt in interface QueryModelpropertyName - The property namesize - The size to constrain by@NonNull public DefaultQuery sizeNe(@NonNull java.lang.String propertyName, @NonNull QueryParameter size)
CriteriasizeNe in interface CriteriasizeNe in interface QueryModelpropertyName - The property namesize - The size to constrain by@NonNull public DefaultQuery eqProperty(@NonNull java.lang.String propertyName, @NonNull java.lang.String otherPropertyName)
CriteriaeqProperty in interface CriteriaeqProperty in interface QueryModelpropertyName - The propertyotherPropertyName - The other property@NonNull public DefaultQuery neProperty(@NonNull java.lang.String propertyName, @NonNull java.lang.String otherPropertyName)
CriterianeProperty in interface CriterianeProperty in interface QueryModelpropertyName - The propertyotherPropertyName - The other property@NonNull public DefaultQuery gtProperty(@NonNull java.lang.String propertyName, @NonNull java.lang.String otherPropertyName)
CriteriagtProperty in interface CriteriagtProperty in interface QueryModelpropertyName - The propertyotherPropertyName - The other property@NonNull public DefaultQuery geProperty(@NonNull java.lang.String propertyName, @NonNull java.lang.String otherPropertyName)
CriteriageProperty in interface CriteriageProperty in interface QueryModelpropertyName - The propertyotherPropertyName - The other property@NonNull public DefaultQuery ltProperty(@NonNull java.lang.String propertyName, @NonNull java.lang.String otherPropertyName)
CriterialtProperty in interface CriterialtProperty in interface QueryModelpropertyName - The propertyotherPropertyName - The other property@NonNull public DefaultQuery leProperty(java.lang.String propertyName, @NonNull java.lang.String otherPropertyName)
CriterialeProperty in interface CriterialeProperty in interface QueryModelpropertyName - The propertyotherPropertyName - The other propertypublic DefaultQuery between(java.lang.String property, QueryParameter start, QueryParameter end)
between in interface Criteriabetween in interface QueryModelproperty - 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