grails.orm
Class HibernateCriteriaBuilder

java.lang.Object
  extended by groovy.lang.GroovyObjectSupport
      extended by grails.orm.HibernateCriteriaBuilder
All Implemented Interfaces:
groovy.lang.GroovyObject, org.grails.datastore.mapping.query.api.Criteria, org.grails.datastore.mapping.query.api.ProjectionList

public class HibernateCriteriaBuilder
extends groovy.lang.GroovyObjectSupport
implements org.grails.datastore.mapping.query.api.Criteria, org.grails.datastore.mapping.query.api.ProjectionList

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 CHAR_ARRAY
           
static org.hibernate.type.Type CHARACTER
           
static org.hibernate.type.Type CHARACTER_ARRAY
           
static org.hibernate.type.Type CHARACTERS_CLOB
           
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)
          Adds a projection to the projectList for the given alias
 org.grails.datastore.mapping.query.api.ProjectionList avg(java.lang.String propertyName)
          Adds a projection that allows the criteria to return the property average value
 org.grails.datastore.mapping.query.api.ProjectionList avg(java.lang.String propertyName, java.lang.String alias)
          Adds a projection that allows the criteria to return the property average value
 org.grails.datastore.mapping.query.api.Criteria between(java.lang.String propertyName, java.lang.Object lo, java.lang.Object hi)
          Creates a "between" Criterion based on the property name and specified lo and hi values
 org.hibernate.Criteria buildCriteria(groovy.lang.Closure<?> criteriaClosure)
           
 void cache(boolean shouldCache)
          Whether to use the query cache
 org.grails.datastore.mapping.query.api.ProjectionList count()
           
 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)
          Adds a projection that allows the criteria to return the property count
 org.grails.datastore.mapping.query.api.ProjectionList countDistinct(java.lang.String propertyName)
          Adds a projection that allows the criteria to return the distinct property count
 org.grails.datastore.mapping.query.api.ProjectionList countDistinct(java.lang.String propertyName, java.lang.String alias)
          Adds a projection that allows the criteria to return the distinct property count
 org.hibernate.Criteria createAlias(java.lang.String associationPath, java.lang.String alias)
          Join an association, assigning an alias to the joined association.
 org.hibernate.Criteria createAlias(java.lang.String associationPath, java.lang.String alias, int joinType)
          Join an association using the specified join-type, assigning an alias to the joined association.
 org.grails.datastore.mapping.query.api.ProjectionList distinct()
           
 org.grails.datastore.mapping.query.api.ProjectionList distinct(java.util.Collection propertyNames)
          A distinct projection that takes a list
 org.grails.datastore.mapping.query.api.ProjectionList distinct(java.util.Collection propertyNames, java.lang.String alias)
          A distinct projection that takes a list
 org.grails.datastore.mapping.query.api.ProjectionList distinct(java.lang.String propertyName)
          A projection that selects a distince property name
 org.grails.datastore.mapping.query.api.ProjectionList distinct(java.lang.String propertyName, java.lang.String alias)
          A projection that selects a distince property name
 org.grails.datastore.mapping.query.api.Criteria eq(java.util.Map params, java.lang.String propertyName, java.lang.Object propertyValue)
          Groovy moves the map to the first parameter if using the idiomatic form, e.g.
 org.grails.datastore.mapping.query.api.Criteria eq(java.lang.String propertyName, java.lang.Object propertyValue)
          Creates an "equals" Criterion based on the specified property name and value.
 org.grails.datastore.mapping.query.api.Criteria eq(java.lang.String propertyName, java.lang.Object propertyValue, java.util.Map params)
          Creates an "equals" Criterion based on the specified property name and value.
 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 equal to 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 equal to all the given returned values
 org.grails.datastore.mapping.query.api.Criteria eqProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
          Creates a Criterion that compares to class properties for equality
 void fetchMode(java.lang.String associationPath, org.hibernate.FetchMode fetchMode)
          Sets the fetch mode of an associated path
 org.grails.datastore.mapping.query.api.Criteria ge(java.lang.String propertyName, java.lang.Object propertyValue)
          Creates a "greater than or equal to" 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 greater than 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)
          Creates a subquery criterion that ensures the given property is greater than all the given returned values
 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 greater than or equal to the second property
static org.hibernate.criterion.DetachedCriteria getHibernateDetachedCriteria(org.grails.datastore.mapping.query.api.QueryableCriteria<?> queryableCriteria)
           
 org.hibernate.Criteria getInstance()
          Returns the criteria instance
 java.lang.Class<?> getTargetClass()
           
 void groupProperty(java.lang.String propertyName)
          Adds a projection that allows the criteria's result to be grouped by a property
 void groupProperty(java.lang.String propertyName, java.lang.String alias)
          Adds a projection that allows the criteria's result to be grouped by a property
 org.grails.datastore.mapping.query.api.Criteria gt(java.lang.String propertyName, java.lang.Object propertyValue)
          Creates a "greater than" Criterion based on the specified property name and value
 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)
          Creates a subquery criterion that ensures the given property is greater than all the given returned values
 org.grails.datastore.mapping.query.api.Criteria gte(java.lang.String s, java.lang.Object o)
           
 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 the second property
 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)
          Creates a Criterion with from the specified property name and "ilike" (a case sensitive version of "like") expression
 org.grails.datastore.mapping.query.api.Criteria in(java.lang.String propertyName, java.util.Collection values)
          Applys a "in" contrain on the specified property
 org.grails.datastore.mapping.query.api.Criteria in(java.lang.String propertyName, java.lang.Object[] values)
          Applys a "in" contrain on the specified property
 org.grails.datastore.mapping.query.api.Criteria inList(java.lang.String propertyName, java.util.Collection values)
          Delegates to in as in is a Groovy keyword
 org.grails.datastore.mapping.query.api.Criteria inList(java.lang.String propertyName, java.lang.Object[] values)
          Delegates to in as in is a Groovy keyword
 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)
          Use a join query
 org.grails.datastore.mapping.query.api.Criteria le(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 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
 org.grails.datastore.mapping.query.api.Criteria leAll(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 leProperty(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 like(java.lang.String propertyName, java.lang.Object propertyValue)
          Creates a Criterion with from the specified property name and "like" expression
 void lock(boolean shouldLock)
          Whether a pessimistic lock should be obtained.
 org.grails.datastore.mapping.query.api.Criteria lt(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 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)
          Creates a subquery criterion that ensures the given property is less than all the given returned values
 org.grails.datastore.mapping.query.api.Criteria lte(java.lang.String s, java.lang.Object o)
           
 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 the second property
 org.grails.datastore.mapping.query.api.ProjectionList max(java.lang.String propertyName)
          Adds a projection that allows the criteria to retrieve a maximum property value
 org.grails.datastore.mapping.query.api.ProjectionList max(java.lang.String propertyName, java.lang.String alias)
          Adds a projection that allows the criteria to retrieve a maximum property value
 org.grails.datastore.mapping.query.api.ProjectionList min(java.lang.String propertyName)
          Adds a projection that allows the criteria to retrieve a minimum property value
 org.grails.datastore.mapping.query.api.ProjectionList min(java.lang.String propertyName, java.lang.String alias)
          Adds a projection that allows the criteria to retrieve a minimum property value
 org.grails.datastore.mapping.query.api.Criteria ne(java.lang.String propertyName, java.lang.Object propertyValue)
          Creates a "not equal" Criterion based on the specified property name and value
 org.grails.datastore.mapping.query.api.Criteria neProperty(java.lang.String propertyName, java.lang.String otherPropertyName)
          Creates a Criterion that compares to class properties for !equality
 org.grails.datastore.mapping.query.api.Criteria notEqual(java.lang.String propertyName, java.lang.Object propertyValue)
           
 org.grails.datastore.mapping.query.api.Criteria order(org.hibernate.criterion.Order o)
          Orders by the specified property name (defaults to ascending)
 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(java.lang.String propertyName, java.lang.String direction)
          Orders by the specified property name and direction
 org.grails.datastore.mapping.query.api.ProjectionList property(java.lang.String propertyName)
          A projection that selects a property name
 org.grails.datastore.mapping.query.api.ProjectionList property(java.lang.String propertyName, java.lang.String alias)
          A projection that selects a property name
 void resultTransformer(org.hibernate.transform.ResultTransformer transformer)
          Sets the resultTransformer.
 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 "rlike" (a regular expression version of "like") expression
 org.grails.datastore.mapping.query.api.ProjectionList rowCount()
          Adds a projection that allows the criteria to return the row count
 org.grails.datastore.mapping.query.api.ProjectionList rowCount(java.lang.String alias)
          Adds a projection that allows the criteria to return the row count
 void select(java.lang.String associationPath)
          Use a select query
 void setGrailsApplication(org.codehaus.groovy.grails.commons.GrailsApplication grailsApplication)
           
 void setUniqueResult(boolean uniqueResult)
          Set whether a unique result should be returned
 org.grails.datastore.mapping.query.api.Criteria sizeEq(java.lang.String propertyName, int size)
          Creates a Criterion that contrains a collection property by 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 greater 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 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 or equal 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 less than to the given size
 org.grails.datastore.mapping.query.api.Criteria sizeNe(java.lang.String propertyName, int size)
          Creates a Criterion that contrains a collection property to be not equal to the given size
protected  void sqlGroupProjection(java.lang.String sql, java.lang.String groupBy, java.util.List<java.lang.String> columnAliases, java.util.List<org.hibernate.type.Type> types)
          Adds a sql projection to the criteria
protected  void sqlProjection(java.lang.String sql, java.util.List<java.lang.String> columnAliases, java.util.List<org.hibernate.type.Type> types)
          Adds a sql projection to the criteria
protected  void sqlProjection(java.lang.String sql, java.lang.String columnAlias, org.hibernate.type.Type type)
          Adds a sql projection to the criteria
 org.grails.datastore.mapping.query.api.Criteria sqlRestriction(java.lang.String sqlRestriction)
          Applies a sql restriction to the results to allow something like:
 org.grails.datastore.mapping.query.api.Criteria sqlRestriction(java.lang.String sqlRestriction, java.util.List<?> values)
          Applies a sql restriction to the results to allow something like:
 org.grails.datastore.mapping.query.api.ProjectionList sum(java.lang.String propertyName)
          Adds a projection that allows the criteria to retrieve the sum of the results of a property
 org.grails.datastore.mapping.query.api.ProjectionList sum(java.lang.String propertyName, java.lang.String alias)
          Adds a projection that allows the criteria to retrieve the sum of the results of a property
 
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, getProperty, setMetaClass, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AND

public static final java.lang.String AND
See Also:
Constant Field Values

IS_NULL

public static final java.lang.String IS_NULL
See Also:
Constant Field Values

IS_NOT_NULL

public static final java.lang.String IS_NOT_NULL
See Also:
Constant Field Values

NOT

public static final java.lang.String NOT
See Also:
Constant Field Values

OR

public static final java.lang.String OR
See Also:
Constant Field Values

ID_EQUALS

public static final java.lang.String ID_EQUALS
See Also:
Constant Field Values

IS_EMPTY

public static final java.lang.String IS_EMPTY
See Also:
Constant Field Values

IS_NOT_EMPTY

public static final java.lang.String IS_NOT_EMPTY
See Also:
Constant Field Values

RLIKE

public static final java.lang.String RLIKE
See Also:
Constant Field Values

BETWEEN

public static final java.lang.String BETWEEN
See Also:
Constant Field Values

EQUALS

public static final java.lang.String EQUALS
See Also:
Constant Field Values

EQUALS_PROPERTY

public static final java.lang.String EQUALS_PROPERTY
See Also:
Constant Field Values

GREATER_THAN

public static final java.lang.String GREATER_THAN
See Also:
Constant Field Values

GREATER_THAN_PROPERTY

public static final java.lang.String GREATER_THAN_PROPERTY
See Also:
Constant Field Values

GREATER_THAN_OR_EQUAL

public static final java.lang.String GREATER_THAN_OR_EQUAL
See Also:
Constant Field Values

GREATER_THAN_OR_EQUAL_PROPERTY

public static final java.lang.String GREATER_THAN_OR_EQUAL_PROPERTY
See Also:
Constant Field Values

ILIKE

public static final java.lang.String ILIKE
See Also:
Constant Field Values

IN

public static final java.lang.String IN
See Also:
Constant Field Values

LESS_THAN

public static final java.lang.String LESS_THAN
See Also:
Constant Field Values

LESS_THAN_PROPERTY

public static final java.lang.String LESS_THAN_PROPERTY
See Also:
Constant Field Values

LESS_THAN_OR_EQUAL

public static final java.lang.String LESS_THAN_OR_EQUAL
See Also:
Constant Field Values

LESS_THAN_OR_EQUAL_PROPERTY

public static final java.lang.String LESS_THAN_OR_EQUAL_PROPERTY
See Also:
Constant Field Values

LIKE

public static final java.lang.String LIKE
See Also:
Constant Field Values

NOT_EQUAL

public static final java.lang.String NOT_EQUAL
See Also:
Constant Field Values

NOT_EQUAL_PROPERTY

public static final java.lang.String NOT_EQUAL_PROPERTY
See Also:
Constant Field Values

SIZE_EQUALS

public static final java.lang.String SIZE_EQUALS
See Also:
Constant Field Values

ORDER_DESCENDING

public static final java.lang.String ORDER_DESCENDING
See Also:
Constant Field Values

ORDER_ASCENDING

public static final java.lang.String ORDER_ASCENDING
See Also:
Constant Field Values

BOOLEAN

public static final org.hibernate.type.Type BOOLEAN

YES_NO

public static final org.hibernate.type.Type YES_NO

BYTE

public static final org.hibernate.type.Type BYTE

CHARACTER

public static final org.hibernate.type.Type CHARACTER

SHORT

public static final org.hibernate.type.Type SHORT

INTEGER

public static final org.hibernate.type.Type INTEGER

LONG

public static final org.hibernate.type.Type LONG

FLOAT

public static final org.hibernate.type.Type FLOAT

DOUBLE

public static final org.hibernate.type.Type DOUBLE

BIG_DECIMAL

public static final org.hibernate.type.Type BIG_DECIMAL

BIG_INTEGER

public static final org.hibernate.type.Type BIG_INTEGER

STRING

public static final org.hibernate.type.Type STRING

NUMERIC_BOOLEAN

public static final org.hibernate.type.Type NUMERIC_BOOLEAN

TRUE_FALSE

public static final org.hibernate.type.Type TRUE_FALSE

URL

public static final org.hibernate.type.Type URL

TIME

public static final org.hibernate.type.Type TIME

DATE

public static final org.hibernate.type.Type DATE

TIMESTAMP

public static final org.hibernate.type.Type TIMESTAMP

CALENDAR

public static final org.hibernate.type.Type CALENDAR

CALENDAR_DATE

public static final org.hibernate.type.Type CALENDAR_DATE

CLASS

public static final org.hibernate.type.Type CLASS

LOCALE

public static final org.hibernate.type.Type LOCALE

CURRENCY

public static final org.hibernate.type.Type CURRENCY

TIMEZONE

public static final org.hibernate.type.Type TIMEZONE

UUID_BINARY

public static final org.hibernate.type.Type UUID_BINARY

UUID_CHAR

public static final org.hibernate.type.Type UUID_CHAR

BINARY

public static final org.hibernate.type.Type BINARY

WRAPPER_BINARY

public static final org.hibernate.type.Type WRAPPER_BINARY

IMAGE

public static final org.hibernate.type.Type IMAGE

BLOB

public static final org.hibernate.type.Type BLOB

MATERIALIZED_BLOB

public static final org.hibernate.type.Type MATERIALIZED_BLOB

WRAPPER_MATERIALIZED_BLOB

public static final org.hibernate.type.Type WRAPPER_MATERIALIZED_BLOB

CHAR_ARRAY

public static final org.hibernate.type.Type CHAR_ARRAY

CHARACTER_ARRAY

public static final org.hibernate.type.Type CHARACTER_ARRAY

TEXT

public static final org.hibernate.type.Type TEXT

CLOB

public static final org.hibernate.type.Type CLOB

MATERIALIZED_CLOB

public static final org.hibernate.type.Type MATERIALIZED_CLOB

WRAPPER_CHARACTERS_CLOB

public static final org.hibernate.type.Type WRAPPER_CHARACTERS_CLOB

CHARACTERS_CLOB

public static final org.hibernate.type.Type CHARACTERS_CLOB

SERIALIZABLE

public static final org.hibernate.type.Type SERIALIZABLE
Constructor Detail

HibernateCriteriaBuilder

public HibernateCriteriaBuilder(java.lang.Class targetClass,
                                org.hibernate.SessionFactory sessionFactory)

HibernateCriteriaBuilder

public HibernateCriteriaBuilder(java.lang.Class targetClass,
                                org.hibernate.SessionFactory sessionFactory,
                                boolean uniqueResult)
Method Detail

setGrailsApplication

public void setGrailsApplication(org.codehaus.groovy.grails.commons.GrailsApplication grailsApplication)

getInstance

public org.hibernate.Criteria getInstance()
Returns the criteria instance

Returns:
The criteria instance

setUniqueResult

public void setUniqueResult(boolean uniqueResult)
Set whether a unique result should be returned

Parameters:
uniqueResult - True if a unique result should be returned

property

public org.grails.datastore.mapping.query.api.ProjectionList property(java.lang.String propertyName)
A projection that selects a property name

Specified by:
property in interface org.grails.datastore.mapping.query.api.ProjectionList
Parameters:
propertyName - The name of the property

property

public org.grails.datastore.mapping.query.api.ProjectionList property(java.lang.String propertyName,
                                                                      java.lang.String alias)
A projection that selects a property name

Parameters:
propertyName - The name of the property
alias - The alias to use

addProjectionToList

protected void addProjectionToList(org.hibernate.criterion.Projection propertyProjection,
                                   java.lang.String alias)
Adds a projection to the projectList for the given alias

Parameters:
propertyProjection - The projection
alias - The alias

sqlProjection

protected void sqlProjection(java.lang.String sql,
                             java.lang.String columnAlias,
                             org.hibernate.type.Type type)
Adds a sql projection to the criteria

Parameters:
sql - SQL projecting a single value
columnAlias - column alias for the projected value
type - the type of the projected value

sqlProjection

protected void sqlProjection(java.lang.String sql,
                             java.util.List<java.lang.String> columnAliases,
                             java.util.List<org.hibernate.type.Type> types)
Adds a sql projection to the criteria

Parameters:
sql - SQL projecting
columnAliases - List of column aliases for the projected values
type - List of types for the projected values

sqlGroupProjection

protected void sqlGroupProjection(java.lang.String sql,
                                  java.lang.String groupBy,
                                  java.util.List<java.lang.String> columnAliases,
                                  java.util.List<org.hibernate.type.Type> types)
Adds a sql projection to the criteria

Parameters:
sql - SQL projecting
groupBy - group by clause
columnAliases - List of column aliases for the projected values
type - List of types for the projected values

distinct

public org.grails.datastore.mapping.query.api.ProjectionList distinct(java.lang.String propertyName)
A projection that selects a distince property name

Specified by:
distinct in interface org.grails.datastore.mapping.query.api.ProjectionList
Parameters:
propertyName - The property name

distinct

public org.grails.datastore.mapping.query.api.ProjectionList distinct(java.lang.String propertyName,
                                                                      java.lang.String alias)
A projection that selects a distince property name

Parameters:
propertyName - The property name
alias - The alias to use

distinct

public org.grails.datastore.mapping.query.api.ProjectionList distinct(java.util.Collection propertyNames)
A distinct projection that takes a list

Parameters:
propertyNames - The list of distince property names

distinct

public org.grails.datastore.mapping.query.api.ProjectionList distinct(java.util.Collection propertyNames,
                                                                      java.lang.String alias)
A distinct projection that takes a list

Parameters:
propertyNames - The list of distince property names
alias - The alias to use

avg

public org.grails.datastore.mapping.query.api.ProjectionList avg(java.lang.String propertyName)
Adds a projection that allows the criteria to return the property average value

Specified by:
avg in interface org.grails.datastore.mapping.query.api.ProjectionList
Parameters:
propertyName - The name of the property

avg

public org.grails.datastore.mapping.query.api.ProjectionList avg(java.lang.String propertyName,
                                                                 java.lang.String alias)
Adds a projection that allows the criteria to return the property average value

Parameters:
propertyName - The name of the property
alias - The alias to use

join

public void join(java.lang.String associationPath)
Use a join query

Parameters:
associationPath - The path of the association

lock

public void lock(boolean shouldLock)
Whether a pessimistic lock should be obtained.

Parameters:
shouldLock - True if it should

select

public void select(java.lang.String associationPath)
Use a select query

Parameters:
associationPath - The path of the association

cache

public void cache(boolean shouldCache)
Whether to use the query cache

Parameters:
shouldCache - True if the query should be cached

getTargetClass

public java.lang.Class<?> getTargetClass()

getHibernateDetachedCriteria

public static org.hibernate.criterion.DetachedCriteria getHibernateDetachedCriteria(org.grails.datastore.mapping.query.api.QueryableCriteria<?> queryableCriteria)

count

public void count(java.lang.String propertyName)
Adds a projection that allows the criteria to return the property count

Parameters:
propertyName - The name of the property

count

public void count(java.lang.String propertyName,
                  java.lang.String alias)
Adds a projection that allows the criteria to return the property count

Parameters:
propertyName - The name of the property
alias - The alias to use

id

public org.grails.datastore.mapping.query.api.ProjectionList id()
Specified by:
id in interface org.grails.datastore.mapping.query.api.ProjectionList

count

public org.grails.datastore.mapping.query.api.ProjectionList count()
Specified by:
count in interface org.grails.datastore.mapping.query.api.ProjectionList

countDistinct

public org.grails.datastore.mapping.query.api.ProjectionList countDistinct(java.lang.String propertyName)
Adds a projection that allows the criteria to return the distinct property count

Specified by:
countDistinct in interface org.grails.datastore.mapping.query.api.ProjectionList
Parameters:
propertyName - The name of the property

distinct

public org.grails.datastore.mapping.query.api.ProjectionList distinct()
Specified by:
distinct in interface org.grails.datastore.mapping.query.api.ProjectionList

countDistinct

public org.grails.datastore.mapping.query.api.ProjectionList countDistinct(java.lang.String propertyName,
                                                                           java.lang.String alias)
Adds a projection that allows the criteria to return the distinct property count

Parameters:
propertyName - The name of the property
alias - The alias to use

groupProperty

public void groupProperty(java.lang.String propertyName)
Adds a projection that allows the criteria's result to be grouped by a property

Parameters:
propertyName - The name of the property

groupProperty

public void groupProperty(java.lang.String propertyName,
                          java.lang.String alias)
Adds a projection that allows the criteria's result to be grouped by a property

Parameters:
propertyName - The name of the property
alias - The alias to use

max

public org.grails.datastore.mapping.query.api.ProjectionList max(java.lang.String propertyName)
Adds a projection that allows the criteria to retrieve a maximum property value

Specified by:
max in interface org.grails.datastore.mapping.query.api.ProjectionList
Parameters:
propertyName - The name of the property

max

public org.grails.datastore.mapping.query.api.ProjectionList max(java.lang.String propertyName,
                                                                 java.lang.String alias)
Adds a projection that allows the criteria to retrieve a maximum property value

Parameters:
propertyName - The name of the property
alias - The alias to use

min

public org.grails.datastore.mapping.query.api.ProjectionList min(java.lang.String propertyName)
Adds a projection that allows the criteria to retrieve a minimum property value

Specified by:
min in interface org.grails.datastore.mapping.query.api.ProjectionList
Parameters:
propertyName - The name of the property

min

public org.grails.datastore.mapping.query.api.ProjectionList min(java.lang.String propertyName,
                                                                 java.lang.String alias)
Adds a projection that allows the criteria to retrieve a minimum property value

Parameters:
alias - The alias to use

rowCount

public org.grails.datastore.mapping.query.api.ProjectionList rowCount()
Adds a projection that allows the criteria to return the row count

Specified by:
rowCount in interface org.grails.datastore.mapping.query.api.ProjectionList

rowCount

public org.grails.datastore.mapping.query.api.ProjectionList rowCount(java.lang.String alias)
Adds a projection that allows the criteria to return the row count

Parameters:
alias - The alias to use

sum

public org.grails.datastore.mapping.query.api.ProjectionList sum(java.lang.String propertyName)
Adds a projection that allows the criteria to retrieve the sum of the results of a property

Specified by:
sum in interface org.grails.datastore.mapping.query.api.ProjectionList
Parameters:
propertyName - The name of the property

sum

public org.grails.datastore.mapping.query.api.ProjectionList sum(java.lang.String propertyName,
                                                                 java.lang.String alias)
Adds a projection that allows the criteria to retrieve the sum of the results of a property

Parameters:
propertyName - The name of the property
alias - The alias to use

fetchMode

public void fetchMode(java.lang.String associationPath,
                      org.hibernate.FetchMode fetchMode)
Sets the fetch mode of an associated path

Parameters:
associationPath - The name of the associated path
fetchMode - The fetch mode to set

resultTransformer

public void resultTransformer(org.hibernate.transform.ResultTransformer transformer)
Sets the resultTransformer.

Parameters:
transformer - The result transformer to use.

createAlias

public org.hibernate.Criteria createAlias(java.lang.String associationPath,
                                          java.lang.String alias)
Join an association, assigning an alias to the joined association.

Functionally equivalent to createAlias(String, String, int) using CriteriaSpecificationINNER_JOIN for the joinType.

Parameters:
associationPath - A dot-seperated property path
alias - The alias to assign to the joined association (for later reference).
Returns:
this (for method chaining) #see createAlias(String, String, int)
Throws:
org.hibernate.HibernateException - Indicates a problem creating the sub criteria

createAlias

public org.hibernate.Criteria createAlias(java.lang.String associationPath,
                                          java.lang.String alias,
                                          int joinType)
Join an association using the specified join-type, assigning an alias to the joined association.

The joinType is expected to be one of CriteriaSpecification.INNER_JOIN (the default), CriteriaSpecificationFULL_JOIN, or CriteriaSpecificationLEFT_JOIN.

Parameters:
associationPath - A dot-seperated property path
alias - The alias to assign to the joined association (for later reference).
joinType - The type of join to use.
Returns:
this (for method chaining)
Throws:
org.hibernate.HibernateException - Indicates a problem creating the sub criteria
See Also:
createAlias(String, String)

eqProperty

public org.grails.datastore.mapping.query.api.Criteria eqProperty(java.lang.String propertyName,
                                                                  java.lang.String otherPropertyName)
Creates a Criterion that compares to class properties for equality

Specified by:
eqProperty in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The first property name
otherPropertyName - The second property name
Returns:
A Criterion instance

neProperty

public org.grails.datastore.mapping.query.api.Criteria neProperty(java.lang.String propertyName,
                                                                  java.lang.String otherPropertyName)
Creates a Criterion that compares to class properties for !equality

Specified by:
neProperty in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The first property name
otherPropertyName - The second property name
Returns:
A Criterion instance

gtProperty

public 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 the second property

Specified by:
gtProperty in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The first property name
otherPropertyName - The second property name
Returns:
A Criterion instance

geProperty

public 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 greater than or equal to the second property

Specified by:
geProperty in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The first property name
otherPropertyName - The second property name
Returns:
A Criterion instance

ltProperty

public 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 the second property

Specified by:
ltProperty in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The first property name
otherPropertyName - The second property name
Returns:
A Criterion instance

leProperty

public org.grails.datastore.mapping.query.api.Criteria leProperty(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

Specified by:
leProperty in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The first property name
otherPropertyName - The second property name
Returns:
A Criterion instance

eqAll

public 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 equal to all the given returned values

Parameters:
propertyName - The property name
propertyValue - The property value
Returns:
A Criterion instance

gtAll

public 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

Parameters:
propertyName - The property name
propertyValue - The property value
Returns:
A Criterion instance

ltAll

public 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

Parameters:
propertyName - The property name
propertyValue - The property value
Returns:
A Criterion instance

geAll

public 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 greater than all the given returned values

Parameters:
propertyName - The property name
propertyValue - The property value
Returns:
A Criterion instance

leAll

public 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 less than all the given returned values

Parameters:
propertyName - The property name
propertyValue - The property value
Returns:
A Criterion instance

eqAll

public 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 equal to all the given returned values

Specified by:
eqAll in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
propertyValue - The property value
Returns:
A Criterion instance

gtAll

public org.grails.datastore.mapping.query.api.Criteria gtAll(java.lang.String propertyName,
                                                             org.grails.datastore.mapping.query.api.QueryableCriteria propertyValue)
Creates a subquery criterion that ensures the given property is greater than all the given returned values

Specified by:
gtAll in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
propertyValue - The property value
Returns:
A Criterion instance

ltAll

public org.grails.datastore.mapping.query.api.Criteria ltAll(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

Specified by:
ltAll in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
propertyValue - The property value
Returns:
A Criterion instance

geAll

public org.grails.datastore.mapping.query.api.Criteria geAll(java.lang.String propertyName,
                                                             org.grails.datastore.mapping.query.api.QueryableCriteria propertyValue)
Creates a subquery criterion that ensures the given property is greater than all the given returned values

Specified by:
geAll in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
propertyValue - The property value
Returns:
A Criterion instance

leAll

public org.grails.datastore.mapping.query.api.Criteria leAll(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

Specified by:
leAll in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
propertyValue - The property value
Returns:
A Criterion instance

gt

public org.grails.datastore.mapping.query.api.Criteria gt(java.lang.String propertyName,
                                                          java.lang.Object propertyValue)
Creates a "greater than" Criterion based on the specified property name and value

Specified by:
gt in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
propertyValue - The property value
Returns:
A Criterion instance

lte

public org.grails.datastore.mapping.query.api.Criteria lte(java.lang.String s,
                                                           java.lang.Object o)
Specified by:
lte in interface org.grails.datastore.mapping.query.api.Criteria

ge

public org.grails.datastore.mapping.query.api.Criteria ge(java.lang.String propertyName,
                                                          java.lang.Object propertyValue)
Creates a "greater than or equal to" Criterion based on the specified property name and value

Specified by:
ge in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
propertyValue - The property value
Returns:
A Criterion instance

lt

public org.grails.datastore.mapping.query.api.Criteria lt(java.lang.String propertyName,
                                                          java.lang.Object propertyValue)
Creates a "less than" Criterion based on the specified property name and value

Specified by:
lt in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
propertyValue - The property value
Returns:
A Criterion instance

le

public org.grails.datastore.mapping.query.api.Criteria le(java.lang.String propertyName,
                                                          java.lang.Object propertyValue)
Creates a "less than or equal to" Criterion based on the specified property name and value

Specified by:
le in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
propertyValue - The property value
Returns:
A Criterion instance

idEquals

public org.grails.datastore.mapping.query.api.Criteria idEquals(java.lang.Object o)
Specified by:
idEquals in interface org.grails.datastore.mapping.query.api.Criteria

isEmpty

public org.grails.datastore.mapping.query.api.Criteria isEmpty(java.lang.String property)
Specified by:
isEmpty in interface org.grails.datastore.mapping.query.api.Criteria

isNotEmpty

public org.grails.datastore.mapping.query.api.Criteria isNotEmpty(java.lang.String property)
Specified by:
isNotEmpty in interface org.grails.datastore.mapping.query.api.Criteria

isNull

public org.grails.datastore.mapping.query.api.Criteria isNull(java.lang.String property)
Specified by:
isNull in interface org.grails.datastore.mapping.query.api.Criteria

isNotNull

public org.grails.datastore.mapping.query.api.Criteria isNotNull(java.lang.String property)
Specified by:
isNotNull in interface org.grails.datastore.mapping.query.api.Criteria

eq

public org.grails.datastore.mapping.query.api.Criteria eq(java.lang.String propertyName,
                                                          java.lang.Object propertyValue)
Creates an "equals" Criterion based on the specified property name and value. Case-sensitive.

Specified by:
eq in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
propertyValue - The property value
Returns:
A Criterion instance

idEq

public org.grails.datastore.mapping.query.api.Criteria idEq(java.lang.Object o)
Specified by:
idEq in interface org.grails.datastore.mapping.query.api.Criteria

eq

public org.grails.datastore.mapping.query.api.Criteria eq(java.util.Map params,
                                                          java.lang.String propertyName,
                                                          java.lang.Object propertyValue)
Groovy moves the map to the first parameter if using the idiomatic form, e.g. eq 'firstName', 'Fred', ignoreCase: true.

Parameters:
params - optional map with customization parameters; currently only 'ignoreCase' is supported.
propertyName -
propertyValue -
Returns:
A Criterion instance

eq

public org.grails.datastore.mapping.query.api.Criteria eq(java.lang.String propertyName,
                                                          java.lang.Object propertyValue,
                                                          java.util.Map params)
Creates an "equals" Criterion based on the specified property name and value. Supports case-insensitive search if the params map contains true under the 'ignoreCase' key.

Parameters:
propertyName - The property name
propertyValue - The property value
params - optional map with customization parameters; currently only 'ignoreCase' is supported.
Returns:
A Criterion instance

sqlRestriction

public 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"
       }
      

Parameters:
sqlRestriction - the sql restriction
Returns:
a Criteria instance

sqlRestriction

public org.grails.datastore.mapping.query.api.Criteria sqlRestriction(java.lang.String sqlRestriction,
                                                                      java.util.List<?> values)
Applies a sql restriction to the results to allow something like:
       def results = Person.withCriteria {
           sqlRestriction "char_length(first_name) < ? AND char_length(first_name) > ?", [4, 9]
       }
      

Parameters:
sqlRestriction - the sql restriction
values - jdbc parameters
Returns:
a Criteria instance

like

public 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 "like" expression

Specified by:
like in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
propertyValue - The like value
Returns:
A Criterion instance

rlike

public 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 "rlike" (a regular expression version of "like") expression

Specified by:
rlike in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
propertyValue - The ilike value
Returns:
A Criterion instance

ilike

public org.grails.datastore.mapping.query.api.Criteria ilike(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

Specified by:
ilike in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
propertyValue - The ilike value
Returns:
A Criterion instance

in

public org.grails.datastore.mapping.query.api.Criteria in(java.lang.String propertyName,
                                                          java.util.Collection values)
Applys a "in" contrain on the specified property

Specified by:
in in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
values - A collection of values
Returns:
A Criterion instance

inList

public org.grails.datastore.mapping.query.api.Criteria inList(java.lang.String propertyName,
                                                              java.util.Collection values)
Delegates to in as in is a Groovy keyword

Specified by:
inList in interface org.grails.datastore.mapping.query.api.Criteria

inList

public org.grails.datastore.mapping.query.api.Criteria inList(java.lang.String propertyName,
                                                              java.lang.Object[] values)
Delegates to in as in is a Groovy keyword

Specified by:
inList in interface org.grails.datastore.mapping.query.api.Criteria

in

public org.grails.datastore.mapping.query.api.Criteria in(java.lang.String propertyName,
                                                          java.lang.Object[] values)
Applys a "in" contrain on the specified property

Specified by:
in in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
values - A collection of values
Returns:
A Criterion instance

order

public org.grails.datastore.mapping.query.api.Criteria order(java.lang.String propertyName)
Orders by the specified property name (defaults to ascending)

Specified by:
order in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name to order by
Returns:
A Order instance

order

public org.grails.datastore.mapping.query.api.Criteria order(org.hibernate.criterion.Order o)
Orders by the specified property name (defaults to ascending)

Parameters:
o - The property name to order by
Returns:
A Order instance

order

public org.grails.datastore.mapping.query.api.Criteria order(java.lang.String propertyName,
                                                             java.lang.String direction)
Orders by the specified property name and direction

Specified by:
order in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name to order by
direction - Either "asc" for ascending or "desc" for descending
Returns:
A Order instance

sizeEq

public org.grails.datastore.mapping.query.api.Criteria sizeEq(java.lang.String propertyName,
                                                              int size)
Creates a Criterion that contrains a collection property by size

Specified by:
sizeEq in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
size - The size to constrain by
Returns:
A Criterion instance

sizeGt

public 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 the given size

Specified by:
sizeGt in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
size - The size to constrain by
Returns:
A Criterion instance

sizeGe

public org.grails.datastore.mapping.query.api.Criteria sizeGe(java.lang.String propertyName,
                                                              int size)
Creates a Criterion that contrains a collection property to be greater than or equal to the given size

Specified by:
sizeGe in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
size - The size to constrain by
Returns:
A Criterion instance

sizeLe

public 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 or equal to the given size

Specified by:
sizeLe in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
size - The size to constrain by
Returns:
A Criterion instance

sizeLt

public org.grails.datastore.mapping.query.api.Criteria sizeLt(java.lang.String propertyName,
                                                              int size)
Creates a Criterion that contrains a collection property to be less than to the given size

Specified by:
sizeLt in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
size - The size to constrain by
Returns:
A Criterion instance

sizeNe

public org.grails.datastore.mapping.query.api.Criteria sizeNe(java.lang.String propertyName,
                                                              int size)
Creates a Criterion that contrains a collection property to be not equal to the given size

Specified by:
sizeNe in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
size - The size to constrain by
Returns:
A Criterion instance

ne

public org.grails.datastore.mapping.query.api.Criteria ne(java.lang.String propertyName,
                                                          java.lang.Object propertyValue)
Creates a "not equal" Criterion based on the specified property name and value

Specified by:
ne in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
propertyValue - The property value
Returns:
The criterion object

notEqual

public org.grails.datastore.mapping.query.api.Criteria notEqual(java.lang.String propertyName,
                                                                java.lang.Object propertyValue)

between

public org.grails.datastore.mapping.query.api.Criteria between(java.lang.String propertyName,
                                                               java.lang.Object lo,
                                                               java.lang.Object hi)
Creates a "between" Criterion based on the property name and specified lo and hi values

Specified by:
between in interface org.grails.datastore.mapping.query.api.Criteria
Parameters:
propertyName - The property name
lo - The low value
hi - The high value
Returns:
A Criterion instance

gte

public org.grails.datastore.mapping.query.api.Criteria gte(java.lang.String s,
                                                           java.lang.Object o)
Specified by:
gte in interface org.grails.datastore.mapping.query.api.Criteria

invokeMethod

public java.lang.Object invokeMethod(java.lang.String name,
                                     java.lang.Object obj)
Specified by:
invokeMethod in interface groovy.lang.GroovyObject
Overrides:
invokeMethod in class groovy.lang.GroovyObjectSupport

buildCriteria

public org.hibernate.Criteria buildCriteria(groovy.lang.Closure<?> criteriaClosure)