|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovy.lang.GroovyObjectSupport grails.orm.HibernateCriteriaBuilder
public class HibernateCriteriaBuilder extends groovy.lang.GroovyObjectSupport
Wraps the Hibernate Criteria API in a builder. The builder can be retrieved through the "createCriteria()" dynamic static method of Grails domain classes (Example in Groovy):
def c = Account.createCriteria() def results = c { projections { groupProperty("branch") } like("holderFirstName", "Fred%") and { between("balance", 500, 1000) eq("branch", "London") } maxResults(10) order("holderLastName", "desc") }
The builder can also be instantiated standalone with a SessionFactory and persistent Class instance:
new HibernateCriteriaBuilder(clazz, sessionFactory).list { eq("firstName", "Fred") }
Field Summary | |
---|---|
static java.lang.String |
AND
|
static java.lang.String |
BETWEEN
|
static org.hibernate.type.Type |
BIG_DECIMAL
|
static org.hibernate.type.Type |
BIG_INTEGER
|
static org.hibernate.type.Type |
BINARY
|
static org.hibernate.type.Type |
BLOB
|
static org.hibernate.type.Type |
BOOLEAN
|
static org.hibernate.type.Type |
BYTE
|
static org.hibernate.type.Type |
CALENDAR
|
static org.hibernate.type.Type |
CALENDAR_DATE
|
static org.hibernate.type.Type |
CHARACTER
|
static org.hibernate.type.Type |
CHARACTERS_CLOB
|
static org.hibernate.type.Type |
CHARACTER_ARRAY
|
static org.hibernate.type.Type |
CHAR_ARRAY
|
static org.hibernate.type.Type |
CLASS
|
static org.hibernate.type.Type |
CLOB
|
static org.hibernate.type.Type |
CURRENCY
|
static org.hibernate.type.Type |
DATE
|
static org.hibernate.type.Type |
DOUBLE
|
static java.lang.String |
EQUALS
|
static java.lang.String |
EQUALS_PROPERTY
|
static org.hibernate.type.Type |
FLOAT
|
static java.lang.String |
GREATER_THAN
|
static java.lang.String |
GREATER_THAN_OR_EQUAL
|
static java.lang.String |
GREATER_THAN_OR_EQUAL_PROPERTY
|
static java.lang.String |
GREATER_THAN_PROPERTY
|
static java.lang.String |
ID_EQUALS
|
static java.lang.String |
ILIKE
|
static org.hibernate.type.Type |
IMAGE
|
static java.lang.String |
IN
|
static org.hibernate.type.Type |
INTEGER
|
static java.lang.String |
IS_EMPTY
|
static java.lang.String |
IS_NOT_EMPTY
|
static java.lang.String |
IS_NOT_NULL
|
static java.lang.String |
IS_NULL
|
static java.lang.String |
LESS_THAN
|
static java.lang.String |
LESS_THAN_OR_EQUAL
|
static java.lang.String |
LESS_THAN_OR_EQUAL_PROPERTY
|
static java.lang.String |
LESS_THAN_PROPERTY
|
static java.lang.String |
LIKE
|
static org.hibernate.type.Type |
LOCALE
|
static org.hibernate.type.Type |
LONG
|
static org.hibernate.type.Type |
MATERIALIZED_BLOB
|
static org.hibernate.type.Type |
MATERIALIZED_CLOB
|
static java.lang.String |
NOT
|
static java.lang.String |
NOT_EQUAL
|
static java.lang.String |
NOT_EQUAL_PROPERTY
|
static org.hibernate.type.Type |
NUMERIC_BOOLEAN
|
static java.lang.String |
OR
|
static java.lang.String |
ORDER_ASCENDING
|
static java.lang.String |
ORDER_DESCENDING
|
static java.lang.String |
RLIKE
|
static org.hibernate.type.Type |
SERIALIZABLE
|
static org.hibernate.type.Type |
SHORT
|
static java.lang.String |
SIZE_EQUALS
|
static org.hibernate.type.Type |
STRING
|
static org.hibernate.type.Type |
TEXT
|
static org.hibernate.type.Type |
TIME
|
static org.hibernate.type.Type |
TIMESTAMP
|
static org.hibernate.type.Type |
TIMEZONE
|
static org.hibernate.type.Type |
TRUE_FALSE
|
static org.hibernate.type.Type |
URL
|
static org.hibernate.type.Type |
UUID_BINARY
|
static org.hibernate.type.Type |
UUID_CHAR
|
static org.hibernate.type.Type |
WRAPPER_BINARY
|
static org.hibernate.type.Type |
WRAPPER_CHARACTERS_CLOB
|
static org.hibernate.type.Type |
WRAPPER_MATERIALIZED_BLOB
|
static org.hibernate.type.Type |
YES_NO
|
Constructor Summary | |
HibernateCriteriaBuilder(java.lang.Class targetClass, org.hibernate.SessionFactory sessionFactory)
|
|
HibernateCriteriaBuilder(java.lang.Class targetClass, org.hibernate.SessionFactory sessionFactory, boolean uniqueResult)
|
Method Summary | |
---|---|
protected void
|
addProjectionToList(org.hibernate.criterion.Projection propertyProjection, java.lang.String alias)
|
org.grails.datastore.mapping.query.api.ProjectionList
|
avg(java.lang.String propertyName)
Use a join query |
org.grails.datastore.mapping.query.api.ProjectionList
|
avg(java.lang.String propertyName, java.lang.String alias)
|
org.grails.datastore.mapping.query.api.Criteria
|
between(java.lang.String propertyName, java.lang.Object lo, java.lang.Object hi)
|
org.hibernate.Criteria
|
buildCriteria(groovy.lang.Closure criteriaClosure)
Throws a runtime exception where necessary to ensure the session gets closed |
void
|
cache(boolean shouldCache)
|
void
|
count(java.lang.String propertyName)
Adds a projection that allows the criteria to return the property count |
void
|
count(java.lang.String propertyName, java.lang.String alias)
|
org.grails.datastore.mapping.query.api.ProjectionList
|
count()
|
org.grails.datastore.mapping.query.api.ProjectionList
|
countDistinct(java.lang.String propertyName)
Adds a projection that allows the criteria's result to be grouped by a property |
org.grails.datastore.mapping.query.api.ProjectionList
|
countDistinct(java.lang.String propertyName, java.lang.String alias)
|
org.hibernate.Criteria
|
createAlias(java.lang.String associationPath, java.lang.String alias)
|
org.hibernate.Criteria
|
createAlias(java.lang.String associationPath, java.lang.String alias, int joinType)
|
org.grails.datastore.mapping.query.api.ProjectionList
|
distinct(java.lang.String propertyName)
|
org.grails.datastore.mapping.query.api.ProjectionList
|
distinct(java.lang.String propertyName, java.lang.String alias)
A distinct projection that takes a list |
org.grails.datastore.mapping.query.api.ProjectionList
|
distinct(java.util.Collection propertyNames)
|
org.grails.datastore.mapping.query.api.ProjectionList
|
distinct(java.util.Collection propertyNames, java.lang.String alias)
Adds a projection that allows the criteria to return the property average value |
org.grails.datastore.mapping.query.api.ProjectionList
|
distinct()
|
org.grails.datastore.mapping.query.api.Criteria
|
eq(java.lang.String propertyName, java.lang.Object propertyValue)
|
org.grails.datastore.mapping.query.api.Criteria
|
eq(java.util.Map params, java.lang.String propertyName, java.lang.Object propertyValue)
|
org.grails.datastore.mapping.query.api.Criteria
|
eq(java.lang.String propertyName, java.lang.Object propertyValue, java.util.Map params)
|
org.grails.datastore.mapping.query.api.Criteria
|
eqAll(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 |
org.grails.datastore.mapping.query.api.Criteria
|
eqAll(java.lang.String propertyName, org.grails.datastore.mapping.query.api.QueryableCriteria propertyValue)
Creates a subquery criterion that ensures the given property is less than all the given returned values |
org.grails.datastore.mapping.query.api.Criteria
|
eqProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
|
void
|
fetchMode(java.lang.String associationPath, org.hibernate.FetchMode fetchMode)
|
org.grails.datastore.mapping.query.api.Criteria
|
ge(java.lang.String propertyName, java.lang.Object propertyValue)
Creates a "less than" Criterion based on the specified property name and value |
org.grails.datastore.mapping.query.api.Criteria
|
geAll(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 |
org.grails.datastore.mapping.query.api.Criteria
|
geAll(java.lang.String propertyName, org.grails.datastore.mapping.query.api.QueryableCriteria propertyValue)
|
org.grails.datastore.mapping.query.api.Criteria
|
geProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
Creates a Criterion that tests if the first property is less than the second property |
static org.hibernate.criterion.DetachedCriteria
|
getHibernateDetachedCriteria(org.grails.datastore.mapping.query.api.QueryableCriteria queryableCriteria)
|
org.hibernate.Criteria
|
getInstance()
A projection that selects a property name |
java.lang.Class
|
getTargetClass()
|
void
|
groupProperty(java.lang.String propertyName)
Adds a projection that allows the criteria to retrieve a maximum property value |
void
|
groupProperty(java.lang.String propertyName, java.lang.String alias)
|
org.grails.datastore.mapping.query.api.Criteria
|
gt(java.lang.String propertyName, java.lang.Object propertyValue)
|
org.grails.datastore.mapping.query.api.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 |
org.grails.datastore.mapping.query.api.Criteria
|
gtAll(java.lang.String propertyName, org.grails.datastore.mapping.query.api.QueryableCriteria propertyValue)
|
org.grails.datastore.mapping.query.api.Criteria
|
gtProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
Creates a Criterion that tests if the first property is greater than or equal to the second property |
org.grails.datastore.mapping.query.api.Criteria
|
gte(java.lang.String s, java.lang.Object o)
|
org.grails.datastore.mapping.query.api.ProjectionList
|
id()
|
org.grails.datastore.mapping.query.api.Criteria
|
idEq(java.lang.Object o)
|
org.grails.datastore.mapping.query.api.Criteria
|
idEquals(java.lang.Object o)
|
org.grails.datastore.mapping.query.api.Criteria
|
ilike(java.lang.String propertyName, java.lang.Object propertyValue)
Applys a "in" contrain on the specified property |
org.grails.datastore.mapping.query.api.Criteria
|
in(java.lang.String propertyName, java.util.Collection values)
Delegates to in as in is a Groovy keyword |
org.grails.datastore.mapping.query.api.Criteria
|
in(java.lang.String propertyName, java.lang.Object[] values)
|
org.grails.datastore.mapping.query.api.Criteria
|
inList(java.lang.String propertyName, java.util.Collection values)
Applys a "in" contrain on the specified property |
org.grails.datastore.mapping.query.api.Criteria
|
inList(java.lang.String propertyName, java.lang.Object[] values)
|
java.lang.Object
|
invokeMethod(java.lang.String name, java.lang.Object obj)
|
org.grails.datastore.mapping.query.api.Criteria
|
isEmpty(java.lang.String property)
|
org.grails.datastore.mapping.query.api.Criteria
|
isNotEmpty(java.lang.String property)
|
org.grails.datastore.mapping.query.api.Criteria
|
isNotNull(java.lang.String property)
|
org.grails.datastore.mapping.query.api.Criteria
|
isNull(java.lang.String property)
|
void
|
join(java.lang.String associationPath)
|
org.grails.datastore.mapping.query.api.Criteria
|
le(java.lang.String propertyName, java.lang.Object propertyValue)
|
org.grails.datastore.mapping.query.api.Criteria
|
leAll(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 |
org.grails.datastore.mapping.query.api.Criteria
|
leAll(java.lang.String propertyName, org.grails.datastore.mapping.query.api.QueryableCriteria propertyValue)
|
org.grails.datastore.mapping.query.api.Criteria
|
leProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
Creates a subquery criterion that ensures the given property is equal to all the given returned values |
org.grails.datastore.mapping.query.api.Criteria
|
like(java.lang.String propertyName, java.lang.Object propertyValue)
Creates a Criterion with from the specified property name and "rlike" (a regular expression version of "like") expression |
void
|
lock(boolean shouldLock)
Use a select query |
org.grails.datastore.mapping.query.api.Criteria
|
lt(java.lang.String propertyName, java.lang.Object propertyValue)
Creates a "less than or equal to" Criterion based on the specified property name and value |
org.grails.datastore.mapping.query.api.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 |
org.grails.datastore.mapping.query.api.Criteria
|
ltAll(java.lang.String propertyName, org.grails.datastore.mapping.query.api.QueryableCriteria propertyValue)
|
org.grails.datastore.mapping.query.api.Criteria
|
ltProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
Creates a Criterion that tests if the first property is less than or equal to the second property |
org.grails.datastore.mapping.query.api.Criteria
|
lte(java.lang.String s, java.lang.Object o)
|
org.grails.datastore.mapping.query.api.ProjectionList
|
max(java.lang.String propertyName)
Adds a projection that allows the criteria to retrieve a minimum property value |
org.grails.datastore.mapping.query.api.ProjectionList
|
max(java.lang.String propertyName, java.lang.String alias)
|
org.grails.datastore.mapping.query.api.ProjectionList
|
min(java.lang.String propertyName)
Adds a projection that allows the criteria to return the row count |
org.grails.datastore.mapping.query.api.ProjectionList
|
min(java.lang.String propertyName, java.lang.String alias)
|
org.grails.datastore.mapping.query.api.Criteria
|
ne(java.lang.String propertyName, java.lang.Object propertyValue)
Creates a "between" Criterion based on the property name and specified lo and hi values |
org.grails.datastore.mapping.query.api.Criteria
|
neProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
Creates a Criterion that tests if the first property is greater than the second property |
org.grails.datastore.mapping.query.api.Criteria
|
notEqual(java.lang.String propertyName, java.lang.Object propertyValue)
|
org.grails.datastore.mapping.query.api.Criteria
|
order(java.lang.String propertyName)
Orders by the specified property name (defaults to ascending) |
org.grails.datastore.mapping.query.api.Criteria
|
order(org.hibernate.criterion.Order o)
Orders by the specified property name and direction |
org.grails.datastore.mapping.query.api.Criteria
|
order(java.lang.String propertyName, java.lang.String direction)
|
org.grails.datastore.mapping.query.api.ProjectionList
|
property(java.lang.String propertyName)
|
org.grails.datastore.mapping.query.api.ProjectionList
|
property(java.lang.String propertyName, java.lang.String alias)
|
void
|
resultTransformer(org.hibernate.transform.ResultTransformer transformer)
|
org.grails.datastore.mapping.query.api.Criteria
|
rlike(java.lang.String propertyName, java.lang.Object propertyValue)
Creates a Criterion with from the specified property name and "ilike" (a case sensitive version of "like") expression |
org.grails.datastore.mapping.query.api.ProjectionList
|
rowCount()
|
org.grails.datastore.mapping.query.api.ProjectionList
|
rowCount(java.lang.String alias)
|
void
|
select(java.lang.String associationPath)
Whether to use the query cache |
void
|
setGrailsApplication(GrailsApplication grailsApplication)
A projection that selects a property name |
void
|
setUniqueResult(boolean uniqueResult)
|
org.grails.datastore.mapping.query.api.Criteria
|
sizeEq(java.lang.String propertyName, int size)
Creates a Criterion that contrains a collection property to be greater than the given size |
org.grails.datastore.mapping.query.api.Criteria
|
sizeGe(java.lang.String propertyName, int size)
Creates a Criterion that contrains a collection property to be less than or equal to the given size |
org.grails.datastore.mapping.query.api.Criteria
|
sizeGt(java.lang.String propertyName, int size)
Creates a Criterion that contrains a collection property to be greater than or equal to the given size |
org.grails.datastore.mapping.query.api.Criteria
|
sizeLe(java.lang.String propertyName, int size)
Creates a Criterion that contrains a collection property to be less than to the given size |
org.grails.datastore.mapping.query.api.Criteria
|
sizeLt(java.lang.String propertyName, int size)
Creates a Criterion that contrains a collection property to be not equal to the given size |
org.grails.datastore.mapping.query.api.Criteria
|
sizeNe(java.lang.String propertyName, int size)
Creates a "not equal" Criterion based on the specified property name and value |
protected void
|
sqlGroupProjection(java.lang.String sql, java.lang.String groupBy, java.util.List columnAliases, java.util.List types)
|
protected void
|
sqlProjection(java.lang.String sql, java.lang.String columnAlias, org.hibernate.type.Type type)
Adds a sql projection to the criteria |
protected void
|
sqlProjection(java.lang.String sql, java.util.List columnAliases, java.util.List types)
A projection that selects a distince property name |
org.grails.datastore.mapping.query.api.Criteria
|
sqlRestriction(java.lang.String sqlRestriction)
Applies a sql restriction to the results to allow something like: def results = Person.withCriteria { sqlRestriction "char_length(first_name) <= 4" } |
org.grails.datastore.mapping.query.api.Criteria
|
sqlRestriction(java.lang.String sqlRestriction, java.util.List values)
|
org.grails.datastore.mapping.query.api.ProjectionList
|
sum(java.lang.String propertyName)
Sets the fetch mode of an associated path |
org.grails.datastore.mapping.query.api.ProjectionList
|
sum(java.lang.String propertyName, java.lang.String alias)
Sets the resultTransformer. |
Methods inherited from class groovy.lang.GroovyObjectSupport | |
---|---|
groovy.lang.GroovyObjectSupport#setProperty(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#getProperty(java.lang.String), groovy.lang.GroovyObjectSupport#getMetaClass(), groovy.lang.GroovyObjectSupport#setMetaClass(groovy.lang.MetaClass), groovy.lang.GroovyObjectSupport#invokeMethod(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#wait(), groovy.lang.GroovyObjectSupport#wait(long), groovy.lang.GroovyObjectSupport#wait(long, int), 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() |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), 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() |
Field Detail |
---|
public static final java.lang.String AND
public static final java.lang.String BETWEEN
public static final org.hibernate.type.Type BIG_DECIMAL
public static final org.hibernate.type.Type BIG_INTEGER
public static final org.hibernate.type.Type BINARY
public static final org.hibernate.type.Type BLOB
public static final org.hibernate.type.Type BOOLEAN
public static final org.hibernate.type.Type BYTE
public static final org.hibernate.type.Type CALENDAR
public static final org.hibernate.type.Type CALENDAR_DATE
public static final org.hibernate.type.Type CHARACTER
public static final org.hibernate.type.Type CHARACTERS_CLOB
public static final org.hibernate.type.Type CHARACTER_ARRAY
public static final org.hibernate.type.Type CHAR_ARRAY
public static final org.hibernate.type.Type CLASS
public static final org.hibernate.type.Type CLOB
public static final org.hibernate.type.Type CURRENCY
public static final org.hibernate.type.Type DATE
public static final org.hibernate.type.Type DOUBLE
public static final java.lang.String EQUALS
public static final java.lang.String EQUALS_PROPERTY
public static final org.hibernate.type.Type FLOAT
public static final java.lang.String GREATER_THAN
public static final java.lang.String GREATER_THAN_OR_EQUAL
public static final java.lang.String GREATER_THAN_OR_EQUAL_PROPERTY
public static final java.lang.String GREATER_THAN_PROPERTY
public static final java.lang.String ID_EQUALS
public static final java.lang.String ILIKE
public static final org.hibernate.type.Type IMAGE
public static final java.lang.String IN
public static final org.hibernate.type.Type INTEGER
public static final java.lang.String IS_EMPTY
public static final java.lang.String IS_NOT_EMPTY
public static final java.lang.String IS_NOT_NULL
public static final java.lang.String IS_NULL
public static final java.lang.String LESS_THAN
public static final java.lang.String LESS_THAN_OR_EQUAL
public static final java.lang.String LESS_THAN_OR_EQUAL_PROPERTY
public static final java.lang.String LESS_THAN_PROPERTY
public static final java.lang.String LIKE
public static final org.hibernate.type.Type LOCALE
public static final org.hibernate.type.Type LONG
public static final org.hibernate.type.Type MATERIALIZED_BLOB
public static final org.hibernate.type.Type MATERIALIZED_CLOB
public static final java.lang.String NOT
public static final java.lang.String NOT_EQUAL
public static final java.lang.String NOT_EQUAL_PROPERTY
public static final org.hibernate.type.Type NUMERIC_BOOLEAN
public static final java.lang.String OR
public static final java.lang.String ORDER_ASCENDING
public static final java.lang.String ORDER_DESCENDING
public static final java.lang.String RLIKE
public static final org.hibernate.type.Type SERIALIZABLE
public static final org.hibernate.type.Type SHORT
public static final java.lang.String SIZE_EQUALS
public static final org.hibernate.type.Type STRING
public static final org.hibernate.type.Type TEXT
public static final org.hibernate.type.Type TIME
public static final org.hibernate.type.Type TIMESTAMP
public static final org.hibernate.type.Type TIMEZONE
public static final org.hibernate.type.Type TRUE_FALSE
public static final org.hibernate.type.Type URL
public static final org.hibernate.type.Type UUID_BINARY
public static final org.hibernate.type.Type UUID_CHAR
public static final org.hibernate.type.Type WRAPPER_BINARY
public static final org.hibernate.type.Type WRAPPER_CHARACTERS_CLOB
public static final org.hibernate.type.Type WRAPPER_MATERIALIZED_BLOB
public static final org.hibernate.type.Type YES_NO
Constructor Detail |
---|
* Set whether a unique result should be returned public HibernateCriteriaBuilder(java.lang.Class targetClass, org.hibernate.SessionFactory sessionFactory)
public HibernateCriteriaBuilder(java.lang.Class targetClass, org.hibernate.SessionFactory sessionFactory, boolean uniqueResult)
Method Detail |
---|
protected void addProjectionToList(org.hibernate.criterion.Projection propertyProjection, java.lang.String alias)
public org.grails.datastore.mapping.query.api.ProjectionList avg(java.lang.String propertyName)
associationPath
- The path of the association
public org.grails.datastore.mapping.query.api.ProjectionList avg(java.lang.String propertyName, java.lang.String alias)
public org.grails.datastore.mapping.query.api.Criteria between(java.lang.String propertyName, java.lang.Object lo, java.lang.Object hi)
public org.hibernate.Criteria buildCriteria(groovy.lang.Closure criteriaClosure)
public void cache(boolean shouldCache)
public void count(java.lang.String propertyName)
propertyName
- The name of the propertyalias
- The alias to use
public void count(java.lang.String propertyName, java.lang.String alias)
public org.grails.datastore.mapping.query.api.ProjectionList count()
public org.grails.datastore.mapping.query.api.ProjectionList countDistinct(java.lang.String propertyName)
propertyName
- The name of the property
public org.grails.datastore.mapping.query.api.ProjectionList countDistinct(java.lang.String propertyName, java.lang.String alias)
public org.hibernate.Criteria createAlias(java.lang.String associationPath, java.lang.String alias)
public org.hibernate.Criteria createAlias(java.lang.String associationPath, java.lang.String alias, int joinType)
public org.grails.datastore.mapping.query.api.ProjectionList distinct(java.lang.String propertyName)
public org.grails.datastore.mapping.query.api.ProjectionList distinct(java.lang.String propertyName, java.lang.String alias)
propertyNames
- The list of distince property namesalias
- The alias to use
*/ public org.grails.datastore.mapping.query.api.ProjectionList distinct(java.util.Collection propertyNames)
public org.grails.datastore.mapping.query.api.ProjectionList avg(String propertyName, String alias) { public org.grails.datastore.mapping.query.api.ProjectionList distinct(java.util.Collection propertyNames, java.lang.String alias)
propertyName
- The name of the propertyalias
- The alias to use
public org.grails.datastore.mapping.query.api.ProjectionList distinct()
public org.grails.datastore.mapping.query.api.Criteria eq(java.lang.String propertyName, java.lang.Object propertyValue)
eq = Property.forName(propertyName).eq((org.hibernate.criterion.DetachedCriteria) propertyValue); public org.grails.datastore.mapping.query.api.Criteria eq(java.util.Map params, java.lang.String propertyName, java.lang.Object propertyValue)
/** public org.grails.datastore.mapping.query.api.Criteria eq(java.lang.String propertyName, java.lang.Object propertyValue, java.util.Map params)
return ltAll(propertyName, new DetachedCriteria(targetClass).build(propertyValue)); public org.grails.datastore.mapping.query.api.Criteria eqAll(java.lang.String propertyName, groovy.lang.Closure propertyValue)
propertyName
- The property namepropertyValue
- The property value
public org.grails.datastore.mapping.query.api.Criteria eqAll(java.lang.String propertyName, @SuppressWarnings("rawtypes") org.grails.datastore.mapping.query.api.QueryableCriteria propertyValue)
propertyName
- The property namepropertyValue
- The property value
public org.grails.datastore.mapping.query.api.Criteria eqProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
public void fetchMode(java.lang.String associationPath, org.hibernate.FetchMode fetchMode)
public org.grails.datastore.mapping.query.api.Criteria ge(java.lang.String propertyName, java.lang.Object propertyValue)
propertyName
- The property namepropertyValue
- The property value
addToCriteria(Property.forName(propertyName).eqAll(getHibernateDetachedCriteria(propertyValue))); public org.grails.datastore.mapping.query.api.Criteria geAll(java.lang.String propertyName, groovy.lang.Closure propertyValue)
propertyName
- The property namepropertyValue
- The property value
public org.grails.datastore.mapping.query.api.Criteria geAll(java.lang.String propertyName, g.grails.datastore.mapping.que org.grails.datastore.mapping.query.api.QueryableCriteria propertyValue)
public org.grails.datastore.mapping.query.api.Criteria geProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
propertyName
- The first property nameotherPropertyName
- The second property name
public static org.hibernate.criterion.DetachedCriteria getHibernateDetachedCriteria(org.grails.datastore.mapping.query.api.QueryableCriteria queryableCriteria)
public org.hibernate.Criteria getInstance()
propertyName
- The name of the propertyalias
- The alias to use
public java.lang.Class getTargetClass()
public void groupProperty(java.lang.String propertyName)
propertyName
- The name of the property
public void groupProperty(java.lang.String propertyName, java.lang.String alias)
public org.grails.datastore.mapping.query.api.Criteria gt(java.lang.String propertyName, java.lang.Object propertyValue)
return geAll(propertyName, new DetachedCriteria(targetClass).build(propertyValue)); public org.grails.datastore.mapping.query.api.Criteria gtAll(java.lang.String propertyName, groovy.lang.Closure propertyValue)
propertyName
- The property namepropertyValue
- The property value
public org.grails.datastore.mapping.query.api.Criteria gtAll(java.lang.String propertyName, g.grails.datastore.mapping.que org.grails.datastore.mapping.query.api.QueryableCriteria propertyValue)
public org.grails.datastore.mapping.query.api.Criteria gtProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
propertyName
- The first property nameotherPropertyName
- The second property name
public org.grails.datastore.mapping.query.api.Criteria gte(java.lang.String s, java.lang.Object o)
public org.grails.datastore.mapping.query.api.ProjectionList id()
public org.grails.datastore.mapping.query.api.Criteria idEq(java.lang.Object o)
public org.grails.datastore.mapping.query.api.Criteria idEquals(java.lang.Object o)
public org.grails.datastore.mapping.query.api.Criteria ilike(java.lang.String propertyName, java.lang.Object propertyValue)
propertyName
- The property namevalues
- A collection of values
public org.grails.datastore.mapping.query.api.Criteria in(java.lang.String propertyName, java.util.Collection values)
public org.grails.datastore.mapping.query.api.Criteria in(java.lang.String propertyName, java.lang.Object[] values)
addToCriteria(Restrictions.in(propertyName, values)); public org.grails.datastore.mapping.query.api.Criteria inList(java.lang.String propertyName, java.util.Collection values)
propertyName
- The property namevalues
- A collection of values
public org.grails.datastore.mapping.query.api.Criteria inList(java.lang.String propertyName, java.lang.Object[] values)
resultTransformer = CriteriaSpecification.DISTINCT_ROOT_ENTITY; } public java.lang.Object invokeMethod(java.lang.String name, java.lang.Object obj)
public org.grails.datastore.mapping.query.api.Criteria isEmpty(java.lang.String property)
public org.grails.datastore.mapping.query.api.Criteria isNotEmpty(java.lang.String property)
public org.grails.datastore.mapping.query.api.Criteria isNotNull(java.lang.String property)
public org.grails.datastore.mapping.query.api.Criteria isNull(java.lang.String property)
public void join(java.lang.String associationPath)
public org.grails.datastore.mapping.query.api.Criteria le(java.lang.String propertyName, java.lang.Object propertyValue)
@SuppressWarnings("rawtypes") QueryableCriteria propertyValue) { public org.grails.datastore.mapping.query.api.Criteria leAll(java.lang.String propertyName, groovy.lang.Closure propertyValue)
propertyName
- The property namepropertyValue
- The property value
public org.grails.datastore.mapping.query.api.Criteria leAll(java.lang.String propertyName, t = Restrictions.gt(propertyNa org.grails.datastore.mapping.query.api.QueryableCriteria propertyValue)
public org.grails.datastore.mapping.query.api.Criteria leProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
propertyName
- The property namepropertyValue
- The property value
public org.grails.datastore.mapping.query.api.Criteria like(java.lang.String propertyName, java.lang.Object propertyValue)
propertyName
- The property namepropertyValue
- The ilike value
public void lock(boolean shouldLock)
associationPath
- The path of the association
public org.grails.datastore.mapping.query.api.Criteria lt(java.lang.String propertyName, java.lang.Object propertyValue)
propertyName
- The property namepropertyValue
- The property value
return leAll(propertyName, new DetachedCriteria(targetClass).build(propertyValue)); public org.grails.datastore.mapping.query.api.Criteria ltAll(java.lang.String propertyName, groovy.lang.Closure propertyValue)
propertyName
- The property namepropertyValue
- The property value
public org.grails.datastore.mapping.query.api.Criteria ltAll(java.lang.String propertyName, org.grails.datastore.mapping.query.api.QueryableCriteria propertyValue)
public org.grails.datastore.mapping.query.api.Criteria ltProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
propertyName
- The first property nameotherPropertyName
- The second property name
public org.grails.datastore.mapping.query.api.Criteria lte(java.lang.String s, java.lang.Object o)
public org.grails.datastore.mapping.query.api.ProjectionList max(java.lang.String propertyName)
propertyName
- The name of the property
public org.grails.datastore.mapping.query.api.ProjectionList max(java.lang.String propertyName, java.lang.String alias)
public org.grails.datastore.mapping.query.api.ProjectionList min(java.lang.String propertyName)
public org.grails.datastore.mapping.query.api.ProjectionList min(java.lang.String propertyName, java.lang.String alias)
public org.grails.datastore.mapping.query.api.Criteria ne(java.lang.String propertyName, java.lang.Object propertyValue)
propertyName
- The property namelo
- The low valuehi
- The high value
public org.grails.datastore.mapping.query.api.Criteria neProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
propertyName
- The first property nameotherPropertyName
- The second property name
public org.grails.datastore.mapping.query.api.Criteria notEqual(java.lang.String propertyName, java.lang.Object propertyValue)
public org.grails.datastore.mapping.query.api.Criteria order(java.lang.String propertyName)
o
- The property name to order by
public org.grails.datastore.mapping.query.api.Criteria order(org.hibernate.criterion.Order o)
propertyName
- The property name to order bydirection
- Either "asc" for ascending or "desc" for descending
public org.grails.datastore.mapping.query.api.Criteria order(java.lang.String propertyName, java.lang.String direction)
public org.grails.datastore.mapping.query.api.ProjectionList property(java.lang.String propertyName)
public org.grails.datastore.mapping.query.api.ProjectionList property(java.lang.String propertyName, java.lang.String alias)
public void resultTransformer(org.hibernate.transform.ResultTransformer transformer)
public org.grails.datastore.mapping.query.api.Criteria rlike(java.lang.String propertyName, java.lang.Object propertyValue)
propertyName
- The property namepropertyValue
- The ilike value
public org.grails.datastore.mapping.query.api.ProjectionList rowCount()
public org.grails.datastore.mapping.query.api.ProjectionList rowCount(java.lang.String alias)
public void select(java.lang.String associationPath)
shouldCache
- True if the query should be cached
public void setGrailsApplication(GrailsApplication grailsApplication)
propertyName
- The name of the property
public void setUniqueResult(boolean uniqueResult)
public org.grails.datastore.mapping.query.api.Criteria sizeEq(java.lang.String propertyName, int size)
propertyName
- The property namesize
- The size to constrain by
public org.grails.datastore.mapping.query.api.Criteria sizeGe(java.lang.String propertyName, int size)
propertyName
- The property namesize
- The size to constrain by
public org.grails.datastore.mapping.query.api.Criteria sizeGt(java.lang.String propertyName, int size)
propertyName
- The property namesize
- The size to constrain by
public org.grails.datastore.mapping.query.api.Criteria sizeLe(java.lang.String propertyName, int size)
propertyName
- The property namesize
- The size to constrain by
public org.grails.datastore.mapping.query.api.Criteria sizeLt(java.lang.String propertyName, int size)
propertyName
- The property namesize
- The size to constrain by
public org.grails.datastore.mapping.query.api.Criteria sizeNe(java.lang.String propertyName, int size)
propertyName
- The property namepropertyValue
- The property value
protected void sqlGroupProjection(java.lang.String sql, java.lang.String groupBy, java.util.List columnAliases, java.util.List types)
protected void sqlProjection(java.lang.String sql, java.lang.String columnAlias, org.hibernate.type.Type type)
sql
- SQL projectinggroupBy
- group by clausecolumnAliases
- List of column aliases for the projected valuestypes
- List of types for the projected values
protected void sqlProjection(java.lang.String sql, java.util.List columnAliases, java.util.List types)
propertyName
- The property name
public org.grails.datastore.mapping.query.api.Criteria sqlRestriction(java.lang.String sqlRestriction)
def results = Person.withCriteria { sqlRestriction "char_length(first_name) <= 4" }
sqlRestriction
- the sql restriction
public org.grails.datastore.mapping.query.api.Criteria sqlRestriction(java.lang.String sqlRestriction, java.util.List values)
public org.grails.datastore.mapping.query.api.ProjectionList sum(java.lang.String propertyName)
associationPath
- The name of the associated pathfetchMode
- The fetch mode to set
public org.grails.datastore.mapping.query.api.ProjectionList sum(java.lang.String propertyName, java.lang.String alias)
transformer
- The result transformer to use.
Groovy Documentation