Package grails.orm

Class HibernateCriteriaBuilder

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

public class HibernateCriteriaBuilder extends AbstractHibernateCriteriaBuilder

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 Details

    • 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
    • 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
    • SERIALIZABLE

      public static final org.hibernate.type.Type SERIALIZABLE
  • Constructor Details

    • HibernateCriteriaBuilder

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

      public HibernateCriteriaBuilder(Class targetClass, org.hibernate.SessionFactory sessionFactory, boolean uniqueResult)
  • Method Details