Top Description Methods
org.hibernate.criterion

public Interface CriteriaQuery

Known Direct Implementers
org.hibernate.loader.criteria.CriteriaQueryTranslator
Imports
org.hibernate.Criteria, .HibernateException, org.hibernate.cfg.NotYetImplementedException, org.hibernate.engine.spi.SessionFactoryImplementor, .TypedValue, org.hibernate.type.Type

An instance of CriteriaQuery is passed to criterion, order and projection instances when actually compiling and executing the query. This interface is not used by application code.
Author
Gavin King

Method Summary

Modifier and TypeMethod and Description
public String[]

Returns:

The column names
findColumns
(String
The property path to resolve
propertyPath
,
Criteria
The criteria
criteria
)

Get the names of the columns mapped by a property path; if the property path is not found in criteria, try the "outer" query.

public String

Returns:

The generated alias
generateSQLAlias
()

Generate a unique SQL alias

public String

Returns:

The column name
getColumn
(Criteria
The overall criteria
criteria
,
String
The property path to resolve
propertyPath
)

Resolve a property path to the name of the column it maps to.

public String[]

Returns:

The column names
getColumns
(String
The property path to resolve
propertyPath
,
Criteria
The criteria
criteria
)

Resolve a property path to the names of the columns it maps to.

public String[]

Returns:

The column names
getColumnsUsingProjection
(Criteria
The criteria
criteria
,
String
The property path to resolve or projection alias
propertyPath
)

Get the names of the columns mapped by a property path.

public String

Returns:

The entity name
getEntityName
(Criteria
The criteria
criteria
)

Get the entity name of an entity

public String

Returns:

The entity name
getEntityName
(Criteria
The criteria
criteria
,
String
The property path that (supposedly) references an entity
propertyPath
)

Get the entity name of an entity, taking into account the qualifier of the property path

public SessionFactoryImplementor

Returns:

The SessionFactory
getFactory
()

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
Provides access to the SessionFactory
public default String[]
getForeignKeyColumns(Criteria criteria, String associationPropertyName)

public default Type
getForeignKeyType(Criteria criteria, String associationPropertyName)

public default TypedValue
getForeignKeyTypeValue(Criteria criteria, String associationPropertyName, Object value)

public String[]

Returns:

The identifier column names
getIdentifierColumns
(Criteria
The criteria
criteria
)

Get the identifier column names of this entity

public Type

Returns:

The identifier type.
getIdentifierType
(Criteria
The criteria
criteria
)

Get the identifier type of this entity

public String

Returns:

The simple property name
getPropertyName
(String
The (possibly qualified) property name
propertyName
)

Get the property name, given a possibly qualified property name

public String

Returns:

The SQL table alias for the given criteria
getSQLAlias
(Criteria
The criteria
criteria
)

Get the root table alias of an entity

public String

Returns:

The SQL table alias for the given criteria
getSQLAlias
(Criteria
The criteria
criteria
,
String
The property path whose SQL alias should be returned.
propertyPath
)

Get the root table alias of an entity, taking into account the qualifier of the property path

public Type

Returns:

The type
getType
(Criteria
The criteria
criteria
,
String
The property path to resolve
propertyPath
)

Get the type of a property path.

public TypedValue

Returns:

The TypedValue
getTypedIdentifierValue
(Criteria
The criteria whose identifier is referenced.
criteria
,
Object
The identifier value
value
)

Build a TypedValue for the given identifier value.

public TypedValue

Returns:

The TypedValue
getTypedValue
(Criteria
The criteria query
criteria
,
String
The property path/alias to resolve to type.
propertyPath
,
Object
The value
value
)

Build a typed-value for the property/value combo.

public Type

Returns:

The type
getTypeUsingProjection
(Criteria
The criteria
criteria
,
String
The property path to resolve or projection alias
propertyPath
)

Get the type of a property path.

Method Detail

findColumnsback to summary
public String[] findColumns(String propertyPath, Criteria criteria) throws HibernateException

Get the names of the columns mapped by a property path; if the property path is not found in criteria, try the "outer" query. Projection aliases are ignored.

Parameters
propertyPath:String

The property path to resolve

criteria:Criteria

The criteria

Returns:String[]

The column names

Exceptions
HibernateException:
if the property could not be resolved
generateSQLAliasback to summary
public String generateSQLAlias()

Generate a unique SQL alias

Returns:String

The generated alias

getColumnback to summary
public String getColumn(Criteria criteria, String propertyPath) throws HibernateException

Resolve a property path to the name of the column it maps to. Ignores projection aliases.

Parameters
criteria:Criteria

The overall criteria

propertyPath:String

The property path to resolve

Returns:String

The column name

Exceptions
HibernateException:
if the property maps to more than 1 column, or if the property could not be resolved
See Also
getColumns
getColumnsback to summary
public String[] getColumns(String propertyPath, Criteria criteria) throws HibernateException

Resolve a property path to the names of the columns it maps to. Ignores projection aliases

Parameters
propertyPath:String

The property path to resolve

criteria:Criteria

The criteria

Returns:String[]

The column names

Exceptions
HibernateException:
if the property maps to more than 1 column, or if the property could not be resolved
getColumnsUsingProjectionback to summary
public String[] getColumnsUsingProjection(Criteria criteria, String propertyPath) throws HibernateException

Get the names of the columns mapped by a property path. Here, the property path can refer to a projection alias.

Parameters
criteria:Criteria

The criteria

propertyPath:String

The property path to resolve or projection alias

Returns:String[]

The column names

Exceptions
HibernateException:
if the property/alias could not be resolved
getEntityNameback to summary
public String getEntityName(Criteria criteria)

Get the entity name of an entity

Parameters
criteria:Criteria

The criteria

Returns:String

The entity name

getEntityNameback to summary
public String getEntityName(Criteria criteria, String propertyPath)

Get the entity name of an entity, taking into account the qualifier of the property path

Parameters
criteria:Criteria

The criteria

propertyPath:String

The property path that (supposedly) references an entity

Returns:String

The entity name

getFactoryback to summary
public SessionFactoryImplementor getFactory()

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

Provides access to the SessionFactory

Returns:SessionFactoryImplementor

The SessionFactory

getForeignKeyColumnsback to summary
public default String[] getForeignKeyColumns(Criteria criteria, String associationPropertyName)
getForeignKeyTypeback to summary
public default Type getForeignKeyType(Criteria criteria, String associationPropertyName)
getForeignKeyTypeValueback to summary
public default TypedValue getForeignKeyTypeValue(Criteria criteria, String associationPropertyName, Object value)
getIdentifierColumnsback to summary
public String[] getIdentifierColumns(Criteria criteria)

Get the identifier column names of this entity

Parameters
criteria:Criteria

The criteria

Returns:String[]

The identifier column names

getIdentifierTypeback to summary
public Type getIdentifierType(Criteria criteria)

Get the identifier type of this entity

Parameters
criteria:Criteria

The criteria

Returns:Type

The identifier type.

getPropertyNameback to summary
public String getPropertyName(String propertyName)

Get the property name, given a possibly qualified property name

Parameters
propertyName:String

The (possibly qualified) property name

Returns:String

The simple property name

getSQLAliasback to summary
public String getSQLAlias(Criteria criteria)

Get the root table alias of an entity

Parameters
criteria:Criteria

The criteria

Returns:String

The SQL table alias for the given criteria

getSQLAliasback to summary
public String getSQLAlias(Criteria criteria, String propertyPath)

Get the root table alias of an entity, taking into account the qualifier of the property path

Parameters
criteria:Criteria

The criteria

propertyPath:String

The property path whose SQL alias should be returned.

Returns:String

The SQL table alias for the given criteria

getTypeback to summary
public Type getType(Criteria criteria, String propertyPath) throws HibernateException

Get the type of a property path.

Parameters
criteria:Criteria

The criteria

propertyPath:String

The property path to resolve

Returns:Type

The type

Exceptions
HibernateException:
if the property could not be resolved
getTypedIdentifierValueback to summary
public TypedValue getTypedIdentifierValue(Criteria criteria, Object value)

Build a TypedValue for the given identifier value.

Parameters
criteria:Criteria

The criteria whose identifier is referenced.

value:Object

The identifier value

Returns:TypedValue

The TypedValue

getTypedValueback to summary
public TypedValue getTypedValue(Criteria criteria, String propertyPath, Object value) throws HibernateException

Build a typed-value for the property/value combo. Essentially the same as manually building a TypedValue using the given value and the resolved type using getTypeUsingProjection.

Parameters
criteria:Criteria

The criteria query

propertyPath:String

The property path/alias to resolve to type.

value:Object

The value

Returns:TypedValue

The TypedValue

Exceptions
HibernateException:
if the property/alias could not be resolved
getTypeUsingProjectionback to summary
public Type getTypeUsingProjection(Criteria criteria, String propertyPath) throws HibernateException

Get the type of a property path. Here, the property path can refer to a projection alias.

Parameters
criteria:Criteria

The criteria

propertyPath:String

The property path to resolve or projection alias

Returns:Type

The type

Exceptions
HibernateException:
if the property/alias could not be resolved