Package org.hibernate.loader.criteria
Class CriteriaQueryTranslator
- java.lang.Object
-
- org.hibernate.loader.criteria.CriteriaQueryTranslator
-
- All Implemented Interfaces:
CriteriaQuery
public class CriteriaQueryTranslator extends java.lang.Object implements CriteriaQuery
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringROOT_SQL_ALIAS
-
Constructor Summary
Constructors Constructor Description CriteriaQueryTranslator(SessionFactoryImplementor factory, org.hibernate.internal.CriteriaImpl criteria, java.lang.String rootEntityName, java.lang.String rootSQLAlias)CriteriaQueryTranslator(SessionFactoryImplementor factory, org.hibernate.internal.CriteriaImpl criteria, java.lang.String rootEntityName, java.lang.String rootSQLAlias, CriteriaQuery outerQuery)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String[]findColumns(java.lang.String propertyName, Criteria subcriteria)Get the names of the columns mapped by a property path; if the property path is not found in subcriteria, try the "outer" query.java.lang.StringgenerateSQLAlias()Generate a unique SQL aliasjava.lang.StringgetColumn(Criteria criteria, java.lang.String propertyName)Resolve a property path to the name of the column it maps to.java.lang.String[]getColumns(java.lang.String propertyName, Criteria subcriteria)Resolve a property path to the names of the columns it maps to.java.lang.String[]getColumnsUsingProjection(Criteria subcriteria, java.lang.String propertyName)Get the names of the columns constrained by this criterion.CriteriagetCriteria(java.lang.String path)java.lang.StringgetEntityName(Criteria criteria)Get the entity name of an entityjava.lang.StringgetEntityName(Criteria subcriteria, java.lang.String propertyName)Get the entity name of an entity, taking into account the qualifier of the property pathSessionFactoryImplementorgetFactory()Provides access to the SessionFactoryjava.lang.String[]getForeignKeyColumns(Criteria criteria, java.lang.String associationPropertyName)TypegetForeignKeyType(Criteria criteria, java.lang.String associationPropertyName)TypedValuegetForeignKeyTypeValue(Criteria criteria, java.lang.String associationPropertyName, java.lang.Object value)java.lang.StringgetGroupBy()java.lang.String[]getIdentifierColumns(Criteria criteria)Get the identifier column names of this entityTypegetIdentifierType(Criteria criteria)Get the identifier type of this entityJoinTypegetJoinType(java.lang.String path)java.lang.StringgetOrderBy()java.lang.String[]getProjectedAliases()java.lang.String[]getProjectedColumnAliases()Type[]getProjectedTypes()java.lang.StringgetPropertyName(java.lang.String propertyName)Get the property name, given a possibly qualified property nameQueryParametersgetQueryParameters()java.util.Set<java.io.Serializable>getQuerySpaces()org.hibernate.internal.CriteriaImplgetRootCriteria()java.lang.StringgetRootSQLALias()java.lang.StringgetSelect()java.lang.StringgetSQLAlias(Criteria criteria)Get the root table alias of an entityjava.lang.StringgetSQLAlias(Criteria criteria, java.lang.String propertyName)Get the root table alias of an entity, taking into account the qualifier of the property pathintgetSQLAliasCount()TypegetType(Criteria subcriteria, java.lang.String propertyName)Get the type of a property path.TypedValuegetTypedIdentifierValue(Criteria criteria, java.lang.Object value)Build a TypedValue for the given identifier value.TypedValuegetTypedValue(Criteria subcriteria, java.lang.String propertyName, java.lang.Object value)Get the typed value for the given property value.TypegetTypeUsingProjection(Criteria subcriteria, java.lang.String propertyName)Get the type of a property path.java.lang.StringgetWhereCondition()java.lang.StringgetWithClause(java.lang.String path)booleanhasProjection()booleanhasRestriction(java.lang.String path)booleanisJoin(java.lang.String path)voidsetAssociations(java.util.Set<java.lang.String> associations)
-
-
-
Field Detail
-
ROOT_SQL_ALIAS
public static final java.lang.String ROOT_SQL_ALIAS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CriteriaQueryTranslator
public CriteriaQueryTranslator(SessionFactoryImplementor factory, org.hibernate.internal.CriteriaImpl criteria, java.lang.String rootEntityName, java.lang.String rootSQLAlias, CriteriaQuery outerQuery) throws HibernateException
- Throws:
HibernateException
-
CriteriaQueryTranslator
public CriteriaQueryTranslator(SessionFactoryImplementor factory, org.hibernate.internal.CriteriaImpl criteria, java.lang.String rootEntityName, java.lang.String rootSQLAlias) throws HibernateException
- Throws:
HibernateException
-
-
Method Detail
-
setAssociations
public void setAssociations(java.util.Set<java.lang.String> associations)
-
generateSQLAlias
public java.lang.String generateSQLAlias()
Description copied from interface:CriteriaQueryGenerate a unique SQL alias- Specified by:
generateSQLAliasin interfaceCriteriaQuery- Returns:
- The generated alias
-
getRootSQLALias
public java.lang.String getRootSQLALias()
-
isJoin
public boolean isJoin(java.lang.String path)
-
getJoinType
public JoinType getJoinType(java.lang.String path)
-
getCriteria
public Criteria getCriteria(java.lang.String path)
-
getQuerySpaces
public java.util.Set<java.io.Serializable> getQuerySpaces()
-
getSQLAliasCount
public int getSQLAliasCount()
-
getRootCriteria
public org.hibernate.internal.CriteriaImpl getRootCriteria()
-
getQueryParameters
public QueryParameters getQueryParameters()
-
hasProjection
public boolean hasProjection()
-
getGroupBy
public java.lang.String getGroupBy()
-
getSelect
public java.lang.String getSelect()
-
getProjectedTypes
public Type[] getProjectedTypes()
-
getProjectedColumnAliases
public java.lang.String[] getProjectedColumnAliases()
-
getProjectedAliases
public java.lang.String[] getProjectedAliases()
-
getWhereCondition
public java.lang.String getWhereCondition()
-
getOrderBy
public java.lang.String getOrderBy()
-
getFactory
public SessionFactoryImplementor getFactory()
Description copied from interface:CriteriaQueryProvides access to the SessionFactory- Specified by:
getFactoryin interfaceCriteriaQuery- Returns:
- The SessionFactory
-
getSQLAlias
public java.lang.String getSQLAlias(Criteria criteria)
Description copied from interface:CriteriaQueryGet the root table alias of an entity- Specified by:
getSQLAliasin interfaceCriteriaQuery- Parameters:
criteria- The criteria- Returns:
- The SQL table alias for the given criteria
-
getEntityName
public java.lang.String getEntityName(Criteria criteria)
Description copied from interface:CriteriaQueryGet the entity name of an entity- Specified by:
getEntityNamein interfaceCriteriaQuery- Parameters:
criteria- The criteria- Returns:
- The entity name
-
getColumn
public java.lang.String getColumn(Criteria criteria, java.lang.String propertyName)
Description copied from interface:CriteriaQueryResolve a property path to the name of the column it maps to. Ignores projection aliases.- Specified by:
getColumnin interfaceCriteriaQuery- Parameters:
criteria- The overall criteriapropertyName- The property path to resolve- Returns:
- The column name
- See Also:
CriteriaQuery.getColumns(java.lang.String, org.hibernate.Criteria)
-
getColumnsUsingProjection
public java.lang.String[] getColumnsUsingProjection(Criteria subcriteria, java.lang.String propertyName) throws HibernateException
Get the names of the columns constrained by this criterion.- Specified by:
getColumnsUsingProjectionin interfaceCriteriaQuery- Parameters:
subcriteria- The criteriapropertyName- The property path to resolve or projection alias- Returns:
- The column names
- Throws:
HibernateException- if the property/alias could not be resolved
-
getIdentifierColumns
public java.lang.String[] getIdentifierColumns(Criteria criteria)
Description copied from interface:CriteriaQueryGet the identifier column names of this entity- Specified by:
getIdentifierColumnsin interfaceCriteriaQuery- Parameters:
criteria- The criteria- Returns:
- The identifier column names
-
getIdentifierType
public Type getIdentifierType(Criteria criteria)
Description copied from interface:CriteriaQueryGet the identifier type of this entity- Specified by:
getIdentifierTypein interfaceCriteriaQuery- Parameters:
criteria- The criteria- Returns:
- The identifier type.
-
getTypedIdentifierValue
public TypedValue getTypedIdentifierValue(Criteria criteria, java.lang.Object value)
Description copied from interface:CriteriaQueryBuild a TypedValue for the given identifier value.- Specified by:
getTypedIdentifierValuein interfaceCriteriaQuery- Parameters:
criteria- The criteria whose identifier is referenced.value- The identifier value- Returns:
- The TypedValue
-
getForeignKeyType
public Type getForeignKeyType(Criteria criteria, java.lang.String associationPropertyName)
- Specified by:
getForeignKeyTypein interfaceCriteriaQuery
-
getForeignKeyColumns
public java.lang.String[] getForeignKeyColumns(Criteria criteria, java.lang.String associationPropertyName)
- Specified by:
getForeignKeyColumnsin interfaceCriteriaQuery
-
getForeignKeyTypeValue
public TypedValue getForeignKeyTypeValue(Criteria criteria, java.lang.String associationPropertyName, java.lang.Object value)
- Specified by:
getForeignKeyTypeValuein interfaceCriteriaQuery
-
getColumns
public java.lang.String[] getColumns(java.lang.String propertyName, Criteria subcriteria) throws HibernateExceptionDescription copied from interface:CriteriaQueryResolve a property path to the names of the columns it maps to. Ignores projection aliases- Specified by:
getColumnsin interfaceCriteriaQuery- Parameters:
propertyName- The property path to resolvesubcriteria- The criteria- Returns:
- The column names
- Throws:
HibernateException- if the property maps to more than 1 column, or if the property could not be resolved
-
findColumns
public java.lang.String[] findColumns(java.lang.String propertyName, Criteria subcriteria) throws HibernateExceptionGet the names of the columns mapped by a property path; if the property path is not found in subcriteria, try the "outer" query. Projection aliases are ignored.- Specified by:
findColumnsin interfaceCriteriaQuery- Parameters:
propertyName- The property path to resolvesubcriteria- The criteria- Returns:
- The column names
- Throws:
HibernateException- if the property could not be resolved
-
getTypeUsingProjection
public Type getTypeUsingProjection(Criteria subcriteria, java.lang.String propertyName) throws HibernateException
Description copied from interface:CriteriaQueryGet the type of a property path. Here, the property path can refer to a projection alias.- Specified by:
getTypeUsingProjectionin interfaceCriteriaQuery- Parameters:
subcriteria- The criteriapropertyName- The property path to resolve or projection alias- Returns:
- The type
- Throws:
HibernateException- if the property/alias could not be resolved
-
getType
public Type getType(Criteria subcriteria, java.lang.String propertyName) throws HibernateException
Description copied from interface:CriteriaQueryGet the type of a property path.- Specified by:
getTypein interfaceCriteriaQuery- Parameters:
subcriteria- The criteriapropertyName- The property path to resolve- Returns:
- The type
- Throws:
HibernateException- if the property could not be resolved
-
getTypedValue
public TypedValue getTypedValue(Criteria subcriteria, java.lang.String propertyName, java.lang.Object value) throws HibernateException
Get the typed value for the given property value.- Specified by:
getTypedValuein interfaceCriteriaQuery- Parameters:
subcriteria- The criteria querypropertyName- 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
public java.lang.String getEntityName(Criteria subcriteria, java.lang.String propertyName)
Description copied from interface:CriteriaQueryGet the entity name of an entity, taking into account the qualifier of the property path- Specified by:
getEntityNamein interfaceCriteriaQuery- Parameters:
subcriteria- The criteriapropertyName- The property path that (supposedly) references an entity- Returns:
- The entity name
-
getSQLAlias
public java.lang.String getSQLAlias(Criteria criteria, java.lang.String propertyName)
Description copied from interface:CriteriaQueryGet the root table alias of an entity, taking into account the qualifier of the property path- Specified by:
getSQLAliasin interfaceCriteriaQuery- Parameters:
criteria- The criteriapropertyName- The property path whose SQL alias should be returned.- Returns:
- The SQL table alias for the given criteria
-
getPropertyName
public java.lang.String getPropertyName(java.lang.String propertyName)
Description copied from interface:CriteriaQueryGet the property name, given a possibly qualified property name- Specified by:
getPropertyNamein interfaceCriteriaQuery- Parameters:
propertyName- The (possibly qualified) property name- Returns:
- The simple property name
-
getWithClause
public java.lang.String getWithClause(java.lang.String path)
-
hasRestriction
public boolean hasRestriction(java.lang.String path)
-
-