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.String
ROOT_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.String
generateSQLAlias()
Generate a unique SQL aliasjava.lang.String
getColumn(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.Criteria
getCriteria(java.lang.String path)
java.lang.String
getEntityName(Criteria criteria)
Get the entity name of an entityjava.lang.String
getEntityName(Criteria subcriteria, java.lang.String propertyName)
Get the entity name of an entity, taking into account the qualifier of the property pathSessionFactoryImplementor
getFactory()
Provides access to the SessionFactoryjava.lang.String[]
getForeignKeyColumns(Criteria criteria, java.lang.String associationPropertyName)
Type
getForeignKeyType(Criteria criteria, java.lang.String associationPropertyName)
TypedValue
getForeignKeyTypeValue(Criteria criteria, java.lang.String associationPropertyName, java.lang.Object value)
java.lang.String
getGroupBy()
java.lang.String[]
getIdentifierColumns(Criteria criteria)
Get the identifier column names of this entityType
getIdentifierType(Criteria criteria)
Get the identifier type of this entityJoinType
getJoinType(java.lang.String path)
java.lang.String
getOrderBy()
java.lang.String[]
getProjectedAliases()
java.lang.String[]
getProjectedColumnAliases()
Type[]
getProjectedTypes()
java.lang.String
getPropertyName(java.lang.String propertyName)
Get the property name, given a possibly qualified property nameQueryParameters
getQueryParameters()
java.util.Set<java.io.Serializable>
getQuerySpaces()
org.hibernate.internal.CriteriaImpl
getRootCriteria()
java.lang.String
getRootSQLALias()
java.lang.String
getSelect()
java.lang.String
getSQLAlias(Criteria criteria)
Get the root table alias of an entityjava.lang.String
getSQLAlias(Criteria criteria, java.lang.String propertyName)
Get the root table alias of an entity, taking into account the qualifier of the property pathint
getSQLAliasCount()
Type
getType(Criteria subcriteria, java.lang.String propertyName)
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 subcriteria, java.lang.String propertyName, java.lang.Object value)
Get the a typed value for the given property value.Type
getTypeUsingProjection(Criteria subcriteria, java.lang.String propertyName)
Get the type of a property path.java.lang.String
getWhereCondition()
java.lang.String
getWithClause(java.lang.String path)
boolean
hasProjection()
boolean
hasRestriction(java.lang.String path)
boolean
isJoin(java.lang.String path)
void
setAssociations(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:CriteriaQuery
Generate a unique SQL alias- Specified by:
generateSQLAlias
in 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:CriteriaQuery
Provides access to the SessionFactory- Specified by:
getFactory
in interfaceCriteriaQuery
- Returns:
- The SessionFactory
-
getSQLAlias
public java.lang.String getSQLAlias(Criteria criteria)
Description copied from interface:CriteriaQuery
Get the root table alias of an entity- Specified by:
getSQLAlias
in 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:CriteriaQuery
Get the entity name of an entity- Specified by:
getEntityName
in 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:CriteriaQuery
Resolve a property path to the name of the column it maps to. Ignores projection aliases.- Specified by:
getColumn
in 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:
getColumnsUsingProjection
in 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:CriteriaQuery
Get the identifier column names of this entity- Specified by:
getIdentifierColumns
in interfaceCriteriaQuery
- Parameters:
criteria
- The criteria- Returns:
- The identifier column names
-
getIdentifierType
public Type getIdentifierType(Criteria criteria)
Description copied from interface:CriteriaQuery
Get the identifier type of this entity- Specified by:
getIdentifierType
in interfaceCriteriaQuery
- Parameters:
criteria
- The criteria- Returns:
- The identifier type.
-
getTypedIdentifierValue
public TypedValue getTypedIdentifierValue(Criteria criteria, java.lang.Object value)
Description copied from interface:CriteriaQuery
Build a TypedValue for the given identifier value.- Specified by:
getTypedIdentifierValue
in 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:
getForeignKeyType
in interfaceCriteriaQuery
-
getForeignKeyColumns
public java.lang.String[] getForeignKeyColumns(Criteria criteria, java.lang.String associationPropertyName)
- Specified by:
getForeignKeyColumns
in interfaceCriteriaQuery
-
getForeignKeyTypeValue
public TypedValue getForeignKeyTypeValue(Criteria criteria, java.lang.String associationPropertyName, java.lang.Object value)
- Specified by:
getForeignKeyTypeValue
in interfaceCriteriaQuery
-
getColumns
public java.lang.String[] getColumns(java.lang.String propertyName, Criteria subcriteria) throws HibernateException
Description copied from interface:CriteriaQuery
Resolve a property path to the names of the columns it maps to. Ignores projection aliases- Specified by:
getColumns
in 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 HibernateException
Get 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:
findColumns
in 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:CriteriaQuery
Get the type of a property path. Here, the property path can refer to a projection alias.- Specified by:
getTypeUsingProjection
in 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:CriteriaQuery
Get the type of a property path.- Specified by:
getType
in 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 a typed value for the given property value.- Specified by:
getTypedValue
in 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:CriteriaQuery
Get the entity name of an entity, taking into account the qualifier of the property path- Specified by:
getEntityName
in 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:CriteriaQuery
Get the root table alias of an entity, taking into account the qualifier of the property path- Specified by:
getSQLAlias
in 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:CriteriaQuery
Get the property name, given a possibly qualified property name- Specified by:
getPropertyName
in 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)
-
-