@groovy.transform.CompileStatic class DetachedCriteria extends java.lang.Object
Represents criteria that is not bound to the current connection and can be built up and re-used at a later date.
Modifiers | Name | Description |
---|---|---|
class |
DetachedCriteria.DetachedProjections |
Modifiers | Name | Description |
---|---|---|
protected java.lang.String |
alias |
|
protected java.util.Map<java.lang.String, DetachedAssociationCriteria> |
associationCriteriaMap |
|
protected java.util.List<Criterion> |
criteria |
|
protected java.lang.Integer |
defaultMax |
|
protected java.lang.Integer |
defaultOffset |
|
protected java.util.List<DynamicFinder> |
dynamicFinders |
|
protected java.util.Map<java.lang.String, javax.persistence.FetchType> |
fetchStrategies |
|
protected java.util.List<Junction> |
junctions |
|
protected groovy.lang.Closure |
lazyQuery |
|
protected java.util.List<Order> |
orders |
|
protected PersistentEntity |
persistentEntity |
|
protected java.util.List<Projection> |
projections |
|
protected java.lang.Class |
targetClass |
Type | Name and description |
---|---|
ProjectionList |
projectionList |
Constructor and description |
---|
DetachedCriteria
(java.lang.Class<T> targetClass, java.lang.String alias = null) Constructs a DetachedCriteria instance target the given class and alias for the name |
Type | Name and description |
---|---|
void |
add(Criterion criterion) |
Criteria |
allEq(java.util.Map<java.lang.String, java.lang.Object> propertyValues) @see Criteria#allEq(java.util.Map) |
Criteria |
and(groovy.lang.Closure callable) Handles a conjunction |
protected void |
applyLazyCriteria() |
boolean |
asBoolean(groovy.lang.Closure additionalCriteria = null) Counts the number of records returned by the query |
N |
asType(java.lang.Class<N> c) Allow casting to a Promise |
DetachedCriteria<T> |
avg(java.lang.String property) Adds a avg projection |
Criteria |
between(java.lang.String propertyName, java.lang.Object start, java.lang.Object finish) @see Criteria |
DetachedCriteria<T> |
build(groovy.lang.Closure callable) Enable the builder syntax for contructing Criteria |
DetachedCriteria<T> |
buildLazy(groovy.lang.Closure callable) Enable the builder syntax for contructing Criteria |
Criteria |
cache(boolean shouldCache) |
protected DetachedCriteria<T> |
clone() |
protected java.util.List |
convertArgumentList(java.util.Collection argList) |
java.lang.Number |
count(java.util.Map args = Collections.emptyMap(, groovy.lang.Closure additionalCriteria = null) Counts the number of records returned by the query |
java.lang.Number |
count(groovy.lang.Closure additionalCriteria) Counts the number of records returned by the query |
Criteria |
createAlias(java.lang.String associationPath, java.lang.String alias) If the underlying datastore supports aliases, then an alias is created for the given association |
java.lang.Number |
deleteAll() Deletes all entities matching this criteria |
DetachedCriteria<T> |
distinct(java.lang.String property) Adds a distinct property projection |
Criteria |
eq(java.lang.String propertyName, java.lang.Object propertyValue) @see Criteria |
Criteria |
eqAll(java.lang.String propertyName, groovy.lang.Closure<?> propertyValue) |
Criteria |
eqAll(java.lang.String propertyName, QueryableCriteria propertyValue) |
Criteria |
eqProperty(java.lang.String propertyName, java.lang.String otherPropertyName) @see Criteria |
Criteria |
exists(QueryableCriteria<?> subquery) @see Criteria#exists(org.grails.datastore.mapping.query.api.QueryableCriteria) |
T |
find(java.util.Map args = Collections.emptyMap(, groovy.lang.Closure additionalCriteria = null) Synonym for #get |
T |
find(groovy.lang.Closure additionalCriteria) Synonym for #get |
Criteria |
ge(java.lang.String property, java.lang.Object value) @see Criteria |
Criteria |
geAll(java.lang.String propertyName, groovy.lang.Closure<?> propertyValue) |
Criteria |
geAll(java.lang.String propertyName, QueryableCriteria propertyValue) |
Criteria |
geProperty(java.lang.String propertyName, java.lang.String otherPropertyName) @see Criteria |
Criteria |
geSome(java.lang.String propertyName, QueryableCriteria propertyValue) |
Criteria |
geSome(java.lang.String propertyName, groovy.lang.Closure<?> propertyValue) |
T |
get(java.util.Map args = Collections.emptyMap(, groovy.lang.Closure additionalCriteria = null) Returns a single result matching the criterion contained within this DetachedCriteria instance |
T |
get(groovy.lang.Closure additionalCriteria) Returns a single result matching the criterion contained within this DetachedCriteria instance |
java.lang.String |
getAlias() @return The root alias to be used for the query |
AsyncQuery<T> |
getAsync() @return The async version of the DetachedCriteria API |
java.util.List<Criterion> |
getCriteria() |
java.util.Map<java.lang.String, javax.persistence.FetchType> |
getFetchStrategies() |
java.util.List<Order> |
getOrders() |
T |
getPersistentClass() |
PersistentEntity |
getPersistentEntity() |
java.util.List<Projection> |
getProjections() |
Criteria |
gt(java.lang.String property, java.lang.Object value) @see Criteria |
Criteria |
gtAll(java.lang.String propertyName, groovy.lang.Closure<?> propertyValue) |
Criteria |
gtAll(java.lang.String propertyName, QueryableCriteria propertyValue) |
Criteria |
gtProperty(java.lang.String propertyName, java.lang.String otherPropertyName) @see Criteria |
Criteria |
gtSome(java.lang.String propertyName, QueryableCriteria propertyValue) |
Criteria |
gtSome(java.lang.String propertyName, groovy.lang.Closure<?> propertyValue) |
Criteria |
gte(java.lang.String property, java.lang.Object value) @see Criteria |
protected void |
handleJunction(groovy.lang.Closure callable) |
DetachedCriteria<T> |
id() Adds an id projection |
Criteria |
idEq(java.lang.Object propertyValue) @see Criteria |
Criteria |
idEquals(java.lang.Object value) @see Criteria |
Criteria |
ilike(java.lang.String propertyName, java.lang.Object propertyValue) @see Criteria |
Criteria |
in(java.lang.String propertyName, java.util.Collection values) @see Criteria |
Criteria |
in(java.lang.String propertyName, QueryableCriteria subquery) @see Criteria |
Criteria |
in(java.lang.String propertyName, groovy.lang.Closure<?> subquery) |
Criteria |
in(java.lang.String propertyName, java.lang.Object[] values) @see Criteria |
Criteria |
inList(java.lang.String propertyName, QueryableCriteria<?> subquery) |
Criteria |
inList(java.lang.String propertyName, groovy.lang.Closure<?> subquery) |
Criteria |
inList(java.lang.String propertyName, java.util.Collection values) @see Criteria |
Criteria |
inList(java.lang.String propertyName, java.lang.Object[] values) @see Criteria |
protected java.lang.Object |
initialiseIfNecessary(java.lang.Class<T> targetClass) |
Criteria |
isEmpty(java.lang.String propertyName) @see Criteria |
Criteria |
isNotEmpty(java.lang.String propertyName) @see Criteria |
Criteria |
isNotNull(java.lang.String propertyName) @see Criteria |
Criteria |
isNull(java.lang.String propertyName) @see Criteria |
java.util.Iterator<T> |
iterator() |
Criteria |
join(java.lang.String property) Specifies whether a join query should be used (if join queries are supported by the underlying datastore) |
Criteria |
le(java.lang.String property, java.lang.Object value) @see Criteria |
Criteria |
leAll(java.lang.String propertyName, groovy.lang.Closure<?> propertyValue) |
Criteria |
leAll(java.lang.String propertyName, QueryableCriteria propertyValue) |
Criteria |
leProperty(java.lang.String propertyName, java.lang.String otherPropertyName) @see Criteria |
Criteria |
leSome(java.lang.String propertyName, QueryableCriteria propertyValue) |
Criteria |
leSome(java.lang.String propertyName, groovy.lang.Closure<?> propertyValue) |
Criteria |
like(java.lang.String propertyName, java.lang.Object propertyValue) @see Criteria |
java.util.List<T> |
list(java.util.Map args = Collections.emptyMap(, groovy.lang.Closure additionalCriteria = null) Returns a single result matching the criterion contained within this DetachedCriteria instance |
java.util.List<T> |
list(groovy.lang.Closure additionalCriteria) Lists all records matching the criterion contained within this DetachedCriteria instance |
Criteria |
lt(java.lang.String property, java.lang.Object value) @see Criteria |
Criteria |
ltAll(java.lang.String propertyName, groovy.lang.Closure<?> propertyValue) |
Criteria |
ltAll(java.lang.String propertyName, QueryableCriteria propertyValue) |
Criteria |
ltProperty(java.lang.String propertyName, java.lang.String otherPropertyName) @see Criteria |
Criteria |
ltSome(java.lang.String propertyName, QueryableCriteria propertyValue) |
Criteria |
ltSome(java.lang.String propertyName, groovy.lang.Closure<?> propertyValue) |
Criteria |
lte(java.lang.String property, java.lang.Object value) @see Criteria |
DetachedCriteria<T> |
max(int max) Sets the default max to use and returns a new criteria instance. |
DetachedCriteria<T> |
max(java.lang.String property) Adds a min projection |
java.lang.Object |
methodMissing(java.lang.String methodName, java.lang.Object args) Method missing handler that deals with the invocation of dynamic finders |
DetachedCriteria<T> |
min(java.lang.String property) Adds a sum projection |
Criteria |
ne(java.lang.String propertyName, java.lang.Object propertyValue) @see Criteria |
Criteria |
neProperty(java.lang.String propertyName, java.lang.String otherPropertyName) @see Criteria#neProperty(java.lang.String, java.lang.String) |
Criteria |
not(groovy.lang.Closure callable) Handles a disjunction |
Criteria |
notExists(QueryableCriteria<?> subquery) @see Criteria#notExists(org.grails.datastore.mapping.query.api.QueryableCriteria) |
Criteria |
notIn(java.lang.String propertyName, QueryableCriteria<?> subquery) |
Criteria |
notIn(java.lang.String propertyName, groovy.lang.Closure<?> subquery) |
DetachedCriteria<T> |
offset(int offset) Sets the default offset to use and returns a new criteria instance. |
Criteria |
or(groovy.lang.Closure callable) Handles a disjunction |
Criteria |
order(java.lang.String propertyName) @see Criteria |
Criteria |
order(Order o) |
Criteria |
order(java.lang.String propertyName, java.lang.String direction) @see Criteria |
Criteria |
projections(groovy.lang.Closure callable) Evaluate projections within the context of the given closure |
DetachedCriteria<T> |
property(java.lang.String property) Adds a property projection |
java.lang.Object |
propertyMissing(java.lang.String name) |
Criteria |
readOnly(boolean readOnly) |
Criteria |
rlike(java.lang.String propertyName, java.lang.Object propertyValue) @see Criteria |
Criteria |
select(java.lang.String property) Specifies whether a select (lazy) query should be used (if join queries are supported by the underlying datastore) |
Criteria |
setAlias(java.lang.String alias) Sets the root alias to be used for the query |
java.lang.Number |
size() Synonym for #count() |
Criteria |
sizeEq(java.lang.String propertyName, int size) @see Criteria |
Criteria |
sizeGe(java.lang.String propertyName, int size) @see Criteria |
Criteria |
sizeGt(java.lang.String propertyName, int size) @see Criteria |
Criteria |
sizeLe(java.lang.String propertyName, int size) @see Criteria |
Criteria |
sizeLt(java.lang.String propertyName, int size) @see Criteria |
Criteria |
sizeNe(java.lang.String propertyName, int size) @see Criteria |
DetachedCriteria<T> |
sort(java.lang.String property) Adds a sort order to this criteria instance |
DetachedCriteria<T> |
sort(java.lang.String property, java.lang.String direction) Adds a sort order to this criteria instance |
DetachedCriteria<T> |
sum(java.lang.String property) Adds a sum projection |
java.lang.Number |
updateAll(java.util.Map properties) Updates all entities matching this criteria |
DetachedCriteria<T> |
where(groovy.lang.Closure additionalQuery) Where method derives a new query from this query. |
DetachedCriteria<T> |
whereLazy(groovy.lang.Closure additionalQuery) Where method derives a new query from this query. |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Constructs a DetachedCriteria instance target the given class and alias for the name
targetClass
- The target classalias
- The root alias to be used in queries
Handles a conjunction
callable
- Callable closureCounts the number of records returned by the query
args
- The argumentsAllow casting to a Promise
c
- The type to cast toAdds a avg projection
property
- The property to avg by
Enable the builder syntax for contructing Criteria
callable
- The callable closureEnable the builder syntax for contructing Criteria
callable
- The callable closureCounts the number of records returned by the query
args
- The argumentsCounts the number of records returned by the query
args
- The argumentsIf the underlying datastore supports aliases, then an alias is created for the given association
associationPath
- The name of the associationalias
- The aliasDeletes all entities matching this criteria
Adds a distinct property projection
property
- The property to obtain the distinct value for
Synonym for #get
Synonym for #get
Returns a single result matching the criterion contained within this DetachedCriteria instance
Returns a single result matching the criterion contained within this DetachedCriteria instance
Adds an id projection
property
- The property to project
Specifies whether a join query should be used (if join queries are supported by the underlying datastore)
property
- The property
Returns a single result matching the criterion contained within this DetachedCriteria instance
Lists all records matching the criterion contained within this DetachedCriteria instance
Sets the default max to use and returns a new criteria instance. This method does not mutate the original criteria!
max
- The max to useAdds a min projection
property
- The property to max byMethod missing handler that deals with the invocation of dynamic finders
methodName
- The method nameargs
- The argumentsAdds a sum projection
property
- The property to min by
Handles a disjunction
callable
- Callable closure
Sets the default offset to use and returns a new criteria instance. This method does not mutate the original criteria!
offset
- The offset to useHandles a disjunction
callable
- Callable closureEvaluate projections within the context of the given closure
callable
- The callableAdds a property projection
property
- The property to projectSpecifies whether a select (lazy) query should be used (if join queries are supported by the underlying datastore)
property
- The propertySets the root alias to be used for the query
alias
- The aliasSynonym for #count()
Adds a sort order to this criteria instance
property
- The property to sort byAdds a sort order to this criteria instance
property
- The property to sort bydirection
- The direction to sort byAdds a sum projection
property
- The property to sum byUpdates all entities matching this criteria
Where method derives a new query from this query. This method will not mutate the original query, but instead return a new one.
additionalQuery
- The additional queryWhere method derives a new query from this query. This method will not mutate the original query, but instead return a new one.
additionalQuery
- The additional query