Package org.hibernate.criterion
Interface CriteriaQuery
-
- All Known Implementing Classes:
CriteriaQueryTranslator
public interface CriteriaQuery
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.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.String[]
findColumns(java.lang.String propertyPath, 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.java.lang.String
generateSQLAlias()
Generate a unique SQL aliasjava.lang.String
getColumn(Criteria criteria, java.lang.String propertyPath)
Resolve a property path to the name of the column it maps to.java.lang.String[]
getColumns(java.lang.String propertyPath, Criteria criteria)
Resolve a property path to the names of the columns it maps to.java.lang.String[]
getColumnsUsingProjection(Criteria criteria, java.lang.String propertyPath)
Get the names of the columns mapped by a property path.java.lang.String
getEntityName(Criteria criteria)
Get the entity name of an entityjava.lang.String
getEntityName(Criteria criteria, java.lang.String propertyPath)
Get the entity name of an entity, taking into account the qualifier of the property pathSessionFactoryImplementor
getFactory()
Provides access to the SessionFactorydefault java.lang.String[]
getForeignKeyColumns(Criteria criteria, java.lang.String associationPropertyName)
default Type
getForeignKeyType(Criteria criteria, java.lang.String associationPropertyName)
default TypedValue
getForeignKeyTypeValue(Criteria criteria, java.lang.String associationPropertyName, java.lang.Object value)
java.lang.String[]
getIdentifierColumns(Criteria criteria)
Get the identifier column names of this entityType
getIdentifierType(Criteria criteria)
Get the identifier type of this entityjava.lang.String
getPropertyName(java.lang.String propertyName)
Get the property name, given a possibly qualified property namejava.lang.String
getSQLAlias(Criteria criteria)
Get the root table alias of an entityjava.lang.String
getSQLAlias(Criteria criteria, java.lang.String propertyPath)
Get the root table alias of an entity, taking into account the qualifier of the property pathType
getType(Criteria criteria, java.lang.String propertyPath)
Get the type of a property path.TypedValue
getTypedIdentifierValue(Criteria criteria, java.lang.Object value)
Build a TypedValue for the given identifier value.TypedValue
getTypedValue(Criteria criteria, java.lang.String propertyPath, java.lang.Object value)
Build a typed-value for the property/value combo.Type
getTypeUsingProjection(Criteria criteria, java.lang.String propertyPath)
Get the type of a property path.
-
-
-
Method Detail
-
getFactory
SessionFactoryImplementor getFactory()
Provides access to the SessionFactory- Returns:
- The SessionFactory
-
getColumn
java.lang.String getColumn(Criteria criteria, java.lang.String propertyPath) throws HibernateException
Resolve a property path to the name of the column it maps to. Ignores projection aliases.- Parameters:
criteria
- The overall criteriapropertyPath
- The property path to resolve- Returns:
- The column name
- Throws:
HibernateException
- if the property maps to more than 1 column, or if the property could not be resolved- See Also:
getColumns(java.lang.String, org.hibernate.Criteria)
-
getColumns
java.lang.String[] getColumns(java.lang.String propertyPath, Criteria criteria) throws HibernateException
Resolve a property path to the names of the columns it maps to. Ignores projection aliases- Parameters:
criteria
- The criteriapropertyPath
- The property path to resolve- Returns:
- The column names
- Throws:
HibernateException
- if the property maps to more than 1 column, or if the property could not be resolved
-
findColumns
java.lang.String[] findColumns(java.lang.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:
criteria
- The criteriapropertyPath
- The property path to resolve- Returns:
- The column names
- Throws:
HibernateException
- if the property could not be resolved
-
getType
Type getType(Criteria criteria, java.lang.String propertyPath) throws HibernateException
Get the type of a property path.- Parameters:
criteria
- The criteriapropertyPath
- The property path to resolve- Returns:
- The type
- Throws:
HibernateException
- if the property could not be resolved
-
getColumnsUsingProjection
java.lang.String[] getColumnsUsingProjection(Criteria criteria, java.lang.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
- The criteriapropertyPath
- The property path to resolve or projection alias- Returns:
- The column names
- Throws:
HibernateException
- if the property/alias could not be resolved
-
getTypeUsingProjection
Type getTypeUsingProjection(Criteria criteria, java.lang.String propertyPath) throws HibernateException
Get the type of a property path. Here, the property path can refer to a projection alias.- Parameters:
criteria
- The criteriapropertyPath
- The property path to resolve or projection alias- Returns:
- The type
- Throws:
HibernateException
- if the property/alias could not be resolved
-
getTypedValue
TypedValue getTypedValue(Criteria criteria, java.lang.String propertyPath, java.lang.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 usinggetTypeUsingProjection(org.hibernate.Criteria, java.lang.String)
.- Parameters:
criteria
- The criteria querypropertyPath
- The property path/alias to resolve to type.value
- The value- Returns:
- The TypedValue
- Throws:
HibernateException
- if the property/alias could not be resolved
-
getEntityName
java.lang.String getEntityName(Criteria criteria)
Get the entity name of an entity- Parameters:
criteria
- The criteria- Returns:
- The entity name
-
getEntityName
java.lang.String getEntityName(Criteria criteria, java.lang.String propertyPath)
Get the entity name of an entity, taking into account the qualifier of the property path- Parameters:
criteria
- The criteriapropertyPath
- The property path that (supposedly) references an entity- Returns:
- The entity name
-
getSQLAlias
java.lang.String getSQLAlias(Criteria criteria)
Get the root table alias of an entity- Parameters:
criteria
- The criteria- Returns:
- The SQL table alias for the given criteria
-
getSQLAlias
java.lang.String getSQLAlias(Criteria criteria, java.lang.String propertyPath)
Get the root table alias of an entity, taking into account the qualifier of the property path- Parameters:
criteria
- The criteriapropertyPath
- The property path whose SQL alias should be returned.- Returns:
- The SQL table alias for the given criteria
-
getPropertyName
java.lang.String getPropertyName(java.lang.String propertyName)
Get the property name, given a possibly qualified property name- Parameters:
propertyName
- The (possibly qualified) property name- Returns:
- The simple property name
-
getIdentifierColumns
java.lang.String[] getIdentifierColumns(Criteria criteria)
Get the identifier column names of this entity- Parameters:
criteria
- The criteria- Returns:
- The identifier column names
-
getIdentifierType
Type getIdentifierType(Criteria criteria)
Get the identifier type of this entity- Parameters:
criteria
- The criteria- Returns:
- The identifier type.
-
getTypedIdentifierValue
TypedValue getTypedIdentifierValue(Criteria criteria, java.lang.Object value)
Build a TypedValue for the given identifier value.- Parameters:
criteria
- The criteria whose identifier is referenced.value
- The identifier value- Returns:
- The TypedValue
-
generateSQLAlias
java.lang.String generateSQLAlias()
Generate a unique SQL alias- Returns:
- The generated alias
-
getForeignKeyType
default Type getForeignKeyType(Criteria criteria, java.lang.String associationPropertyName)
-
getForeignKeyColumns
default java.lang.String[] getForeignKeyColumns(Criteria criteria, java.lang.String associationPropertyName)
-
getForeignKeyTypeValue
default TypedValue getForeignKeyTypeValue(Criteria criteria, java.lang.String associationPropertyName, java.lang.Object value)
-
-