public class HibernateAssociationQuery extends AssociationQuery
A thin wrapper over HibernateQuery that collects criteria for a single association scope.
When HibernateQuery.createQuery is called (e.g. via Person.withCriteria
{ pets { eq 'name', 'Lucky' }}), the AbstractCriteriaBuilder sets the current query to
this instance and routes all criteria added inside the closure through add(Query.Criterion). Those criteria are held by an inner HibernateQuery scoped to the
associated entity.
At query-execution time, PredicateGenerator dispatches on this type and performs a
LEFT JOIN on associationPath, then applies the collected predicates.
| Fields inherited from class | Fields |
|---|---|
class Query |
criteria, entity, fetchStrategies, joinTypes, lockResult, logger, max, offset, orderBy, projections, queryCache, session, uniqueResult |
| Constructor and description |
|---|
HibernateAssociationQuery(HibernateSession session, GrailsHibernatePersistentEntity associatedEntity, Association association, java.lang.String associationPath, java.lang.String alias) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
add(Criterion criterion) |
|
public void |
add(Junction currentJunction, Criterion criterion) |
|
public Junction |
disjunction() |
|
public java.util.List<Query.Criterion> |
getAssociationCriteria()Returns the criteria collected inside the association closure. |
|
public GrailsHibernatePersistentEntity |
getEntity() |
|
public Junction |
negation() |
| Methods inherited from class | Name |
|---|---|
class AssociationQuery |
executeQuery, getAssociation |
class Query |
add, add, allEq, and, between, cache, clearOrders, clone, conjunction, countResults, createQuery, disjunction, eq, executeQuery, fetchStrategy, firstResult, flushBeforeQuery, ge, getCriteria, getEntity, getMax, getOffset, getOrderBy, getSession, gt, gte, idEq, ilike, in, isEmpty, isNotEmpty, isNotNull, isNull, join, join, le, like, list, lock, lock, lt, lte, max, maxResults, negation, offset, or, order, patternToRegex, projections, resolveIdIfEntity, rlike, select, setUniqueResult, singleResult |
Returns the criteria collected inside the association closure.