@java.lang.SuppressWarnings("rawtypes")
public class CriteriaBuilder
extends groovy.lang.GroovyObjectSupport
Criteria builder implementation that operates against DataStore abstraction.
| Modifiers | Name | Description |
|---|---|---|
static java.lang.String |
ORDER_ASCENDING |
|
static java.lang.String |
ORDER_DESCENDING |
|
protected java.util.List<Query.Order> |
orderEntries |
|
protected PersistentEntity |
persistentEntity |
|
protected ProjectionList |
projectionList |
|
protected Query |
query |
|
protected groovy.lang.MetaObjectProtocol |
queryMetaClass |
|
protected boolean |
readOnly |
|
protected Session |
session |
|
protected java.lang.Class |
targetClass |
| Constructor and description |
|---|
CriteriaBuilder
(java.lang.Class targetClass, Session session) |
CriteriaBuilder
(java.lang.Class targetClass, Session session, Query query) |
| Type | Name and description |
|---|---|
protected Criterion |
addToCriteria(Criterion c) |
Criteria |
allEq(java.util.Map<java.lang.String, java.lang.Object> propertyValues)Apply an "equals" constraint to each property in the key set of a Map |
Criteria |
and(groovy.lang.Closure callable) |
ProjectionList |
avg(java.lang.String name)Computes the average value of a property |
Criteria |
between(java.lang.String propertyName, java.lang.Object start, java.lang.Object finish)Restricts the results by the given property value range (inclusive) |
void |
build(groovy.lang.Closure criteria) |
BuildableCriteria |
cache(boolean cache) |
ProjectionList |
count()Count the number of records returned |
java.lang.Number |
count(groovy.lang.Closure callable)Defines and executes a count query in a single call. |
ProjectionList |
countDistinct(java.lang.String property)Projection that signifies to count distinct results |
ProjectionList |
distinct()Projection that signifies to return only distinct results |
ProjectionList |
distinct(java.lang.String property)Projection that signifies to return only distinct results |
Criteria |
eq(java.lang.String propertyName, java.lang.Object propertyValue)Creates an "equals" Criterion based on the specified property name and value. |
Criteria |
eqAll(java.lang.String propertyName, groovy.lang.Closure propertyValue)Creates a subquery criterion that ensures the given property is equal to all the given returned values |
Criteria |
eqAll(java.lang.String propertyName, QueryableCriteria propertyValue)Creates a subquery criterion that ensures the given property is equal to all the given returned values |
Criteria |
eqProperty(java.lang.String propertyName, java.lang.String otherPropertyName)Constraints a property to be equal to a specified other property |
Criteria |
exists(QueryableCriteria<?> subquery) |
Criteria |
ge(java.lang.String property, java.lang.Object value)Used to restrict a value to be greater than or equal to the given value |
Criteria |
geAll(java.lang.String propertyName, groovy.lang.Closure propertyValue)Creates a subquery criterion that ensures the given property is greater than all the given returned values |
Criteria |
geAll(java.lang.String propertyName, QueryableCriteria propertyValue)Creates a subquery criterion that ensures the given property is greater than all the given returned values |
Criteria |
geProperty(java.lang.String propertyName, java.lang.String otherPropertyName)Constraints a property to be greater than or equal to a specified other property |
Criteria |
geSome(java.lang.String propertyName, QueryableCriteria propertyValue) |
Criteria |
geSome(java.lang.String propertyName, groovy.lang.Closure<?> propertyValue) |
java.lang.Object |
get(groovy.lang.Closure callable)Defines and executes a get query (a single result) in a single call. |
Query |
getQuery() |
java.lang.Class |
getTargetClass() |
ProjectionList |
groupProperty(java.lang.String property)Defines a group by projection for datastores that support it |
Criteria |
gt(java.lang.String property, java.lang.Object value)Used to restrict a value to be greater than or equal to the given value |
Criteria |
gtAll(java.lang.String propertyName, groovy.lang.Closure propertyValue)Creates a subquery criterion that ensures the given property is greater than all the given returned values |
Criteria |
gtAll(java.lang.String propertyName, QueryableCriteria propertyValue)Creates a subquery criterion that ensures the given property is greater than all the given returned values |
Criteria |
gtProperty(java.lang.String propertyName, java.lang.String otherPropertyName)Constraints a property to be greater than a specified other property |
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)Used to restrict a value to be greater than or equal to the given value |
ProjectionList |
id() |
Criteria |
idEq(java.lang.Object propertyValue)Creates an "equals" Criterion based on the specified property name and value. |
Criteria |
idEquals(java.lang.Object value) |
Criteria |
ilike(java.lang.String propertyName, java.lang.Object propertyValue)Creates an ilike Criterion based on the specified property name and value. |
Criteria |
in(java.lang.String propertyName, QueryableCriteria<?> subquery) |
Criteria |
in(java.lang.String propertyName, groovy.lang.Closure<?> subquery) |
Criteria |
in(java.lang.String propertyName, java.util.Collection values)Creates an "in" Criterion based on the specified property name and list of values. |
Criteria |
in(java.lang.String propertyName, java.lang.Object[] values)Creates an "in" Criterion based on the specified property name and list of values. |
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)Creates an "in" Criterion based on the specified property name and list of values. |
Criteria |
inList(java.lang.String propertyName, java.lang.Object[] values)Creates an "in" Criterion based on the specified property name and list of values. |
java.lang.Object |
invokeMethod(java.lang.String name, java.lang.Object obj) |
Criteria |
isEmpty(java.lang.String propertyName) |
Criteria |
isNotEmpty(java.lang.String propertyName) |
Criteria |
isNotNull(java.lang.String propertyName) |
Criteria |
isNull(java.lang.String propertyName) |
BuildableCriteria |
join(java.lang.String property) |
Criteria |
le(java.lang.String property, java.lang.Object value)Used to restrict a value to be less than or equal to the given value |
Criteria |
leAll(java.lang.String propertyName, groovy.lang.Closure propertyValue)Creates a subquery criterion that ensures the given property is less than all the given returned values |
Criteria |
leAll(java.lang.String propertyName, QueryableCriteria propertyValue)Creates a subquery criterion that ensures the given property is less than all the given returned values |
Criteria |
leProperty(java.lang.String propertyName, java.lang.String otherPropertyName)Constraints a property to be less than or equal to a specified other property |
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)Creates an like Criterion based on the specified property name and value. |
java.util.List |
list(groovy.lang.Closure callable)Defines and executes a list query in a single call. |
java.util.List |
list(java.util.Map paginateParams, groovy.lang.Closure callable) |
java.util.List |
listDistinct(groovy.lang.Closure callable)Defines and executes a list distinct query in a single call. |
Criteria |
lt(java.lang.String property, java.lang.Object value)Used to restrict a value to be less than or equal to the given value |
Criteria |
ltAll(java.lang.String propertyName, groovy.lang.Closure propertyValue)Creates a subquery criterion that ensures the given property is less than all the given returned values |
Criteria |
ltAll(java.lang.String propertyName, QueryableCriteria propertyValue)Creates a subquery criterion that ensures the given property is less than all the given returned values |
Criteria |
ltProperty(java.lang.String propertyName, java.lang.String otherPropertyName)Constraints a property to be less than a specified other property |
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)Used to restrict a value to be less than or equal to the given value |
ProjectionList |
max(java.lang.String name)Computes the max value of a property |
ProjectionList |
min(java.lang.String name)Computes the min value of a property |
Criteria |
ne(java.lang.String propertyName, java.lang.Object propertyValue)Creates a "not equals" Criterion based on the specified property name and value. |
Criteria |
neProperty(java.lang.String propertyName, java.lang.String otherPropertyName)Constraints a property to be not equal to a specified other property |
Criteria |
not(groovy.lang.Closure callable) |
Criteria |
notExists(QueryableCriteria<?> subquery) |
Criteria |
notIn(java.lang.String propertyName, QueryableCriteria<?> subquery) |
Criteria |
notIn(java.lang.String propertyName, groovy.lang.Closure<?> subquery) |
Criteria |
or(groovy.lang.Closure callable) |
Criteria |
order(java.lang.String propertyName)Orders by the specified property name (defaults to ascending) |
Criteria |
order(Order o)Orders by the specified property name (defaults to ascending) |
Criteria |
order(java.lang.String propertyName, java.lang.String direction)Orders by the specified property name and direction |
ProjectionList |
projections(groovy.lang.Closure callable)Defines projections |
ProjectionList |
property(java.lang.String name)A projection that obtains the value of a property of an entity |
BuildableCriteria |
readOnly(boolean readOnly) |
Criteria |
rlike(java.lang.String propertyName, java.lang.Object propertyValue)Creates an rlike Criterion based on the specified property name and value. |
ProjectionList |
rowCount()Count the number of records returned |
java.lang.Object |
scroll(groovy.lang.Closure c) |
BuildableCriteria |
select(java.lang.String property) |
void |
setUniqueResult(boolean uniqueResult) |
Criteria |
sizeEq(java.lang.String propertyName, int size) |
Criteria |
sizeGe(java.lang.String propertyName, int size) |
Criteria |
sizeGt(java.lang.String propertyName, int size) |
Criteria |
sizeLe(java.lang.String propertyName, int size) |
Criteria |
sizeLt(java.lang.String propertyName, int size) |
Criteria |
sizeNe(java.lang.String propertyName, int size) |
ProjectionList |
sum(java.lang.String name)Computes the sum of a property |
protected void |
validatePropertyName(java.lang.String propertyName, java.lang.String methodName) |
| Methods inherited from class | Name |
|---|---|
class groovy.lang.GroovyObjectSupport |
groovy.lang.GroovyObjectSupport#getMetaClass(), groovy.lang.GroovyObjectSupport#setMetaClass(groovy.lang.MetaClass), groovy.lang.GroovyObjectSupport#invokeMethod(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#setProperty(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#getProperty(java.lang.String), groovy.lang.GroovyObjectSupport#wait(long, int), groovy.lang.GroovyObjectSupport#wait(long), groovy.lang.GroovyObjectSupport#wait(), groovy.lang.GroovyObjectSupport#equals(java.lang.Object), groovy.lang.GroovyObjectSupport#toString(), groovy.lang.GroovyObjectSupport#hashCode(), groovy.lang.GroovyObjectSupport#getClass(), groovy.lang.GroovyObjectSupport#notify(), groovy.lang.GroovyObjectSupport#notifyAll() |
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() |
Apply an "equals" constraint to each property in the key set of a Map
propertyValues - a map from property names to valuesComputes the average value of a property
name - The name of the propertyRestricts the results by the given property value range (inclusive)
propertyName - The property namestart - The start of the rangefinish - The end of the rangeCount the number of records returned
Defines and executes a count query in a single call. Example: Foo.createCriteria.count { }
callable - The closure to executeProjection that signifies to count distinct results
property - The name of the propertyProjection that signifies to return only distinct results
Projection that signifies to return only distinct results
property - The name of the propertyCreates an "equals" Criterion based on the specified property name and value.
propertyName - The property namepropertyValue - The property valueCreates a subquery criterion that ensures the given property is equal to all the given returned values
propertyName - The property namepropertyValue - The property valueCreates a subquery criterion that ensures the given property is equal to all the given returned values
propertyName - The property namepropertyValue - The property valueConstraints a property to be equal to a specified other property
propertyName - The propertyotherPropertyName - The other propertyUsed to restrict a value to be greater than or equal to the given value
property - The propertyvalue - The valueCreates a subquery criterion that ensures the given property is greater than all the given returned values
propertyName - The property namepropertyValue - The property valueCreates a subquery criterion that ensures the given property is greater than all the given returned values
propertyName - The property namepropertyValue - The property valueConstraints a property to be greater than or equal to a specified other property
propertyName - The propertyotherPropertyName - The other propertyDefines and executes a get query (a single result) in a single call. Example: Foo.createCriteria.get { }
callable - The closure to executeDefines a group by projection for datastores that support it
property - The property nameUsed to restrict a value to be greater than or equal to the given value
property - The propertyvalue - The valueCreates a subquery criterion that ensures the given property is greater than all the given returned values
propertyName - The property namepropertyValue - The property valueCreates a subquery criterion that ensures the given property is greater than all the given returned values
propertyName - The property namepropertyValue - The property valueConstraints a property to be greater than a specified other property
propertyName - The propertyotherPropertyName - The other propertyUsed to restrict a value to be greater than or equal to the given value
property - The propertyvalue - The valueCreates an "equals" Criterion based on the specified property name and value.
propertyValue - The property valueCreates an ilike Criterion based on the specified property name and value. Unlike a like condition, ilike is case insensitive
propertyName - The property namepropertyValue - The property valueCreates an "in" Criterion based on the specified property name and list of values.
propertyName - The property namevalues - The valuesCreates an "in" Criterion based on the specified property name and list of values.
propertyName - The property namevalues - The valuesCreates an "in" Criterion based on the specified property name and list of values.
propertyName - The property namevalues - The valuesCreates an "in" Criterion based on the specified property name and list of values.
propertyName - The property namevalues - The valuesUsed to restrict a value to be less than or equal to the given value
property - The propertyvalue - The valueCreates a subquery criterion that ensures the given property is less than all the given returned values
propertyName - The property namepropertyValue - The property valueCreates a subquery criterion that ensures the given property is less than all the given returned values
propertyName - The property namepropertyValue - The property valueConstraints a property to be less than or equal to a specified other property
propertyName - The propertyotherPropertyName - The other propertyCreates an like Criterion based on the specified property name and value.
propertyName - The property namepropertyValue - The property valueDefines and executes a list query in a single call. Example: Foo.createCriteria.list { }
callable - The closure to executeDefines and executes a list distinct query in a single call. Example: Foo.createCriteria.listDistinct { }
callable - The closure to executeUsed to restrict a value to be less than or equal to the given value
property - The propertyvalue - The valueCreates a subquery criterion that ensures the given property is less than all the given returned values
propertyName - The property namepropertyValue - The property valueCreates a subquery criterion that ensures the given property is less than all the given returned values
propertyName - The property namepropertyValue - The property valueConstraints a property to be less than a specified other property
propertyName - The propertyotherPropertyName - The other propertyUsed to restrict a value to be less than or equal to the given value
property - The propertyvalue - The valueComputes the max value of a property
name - The name of the propertyComputes the min value of a property
name - The name of the propertyCreates a "not equals" Criterion based on the specified property name and value.
propertyName - The property namepropertyValue - The property valueConstraints a property to be not equal to a specified other property
propertyName - The propertyotherPropertyName - The other propertyOrders by the specified property name (defaults to ascending)
propertyName - The property name to order byOrders by the specified property name (defaults to ascending)
o - The order objectOrders by the specified property name and direction
propertyName - The property name to order bydirection - Either "asc" for ascending or "desc" for descendingDefines projections
callable - The closure defining the projectionsA projection that obtains the value of a property of an entity
name - The name of the propertyCreates an rlike Criterion based on the specified property name and value.
propertyName - The property namepropertyValue - The property valueCount the number of records returned
Computes the sum of a property
name - The name of the property