Top Description Inners Fields Constructors Methods
org.hibernate.hql.internal.ast.tree

public Class DotNode

extends FromReferenceNode
implements DisplayableNode, SelectExpression, TableReferenceNode
Class Inheritance
All Implemented Interfaces
org.hibernate.hql.internal.ast.tree.TableReferenceNode, org.hibernate.hql.internal.ast.tree.SelectExpression, org.hibernate.hql.internal.ast.tree.DisplayableNode
Imports
org.hibernate.QueryException, org.hibernate.engine.internal.JoinSequence, org.hibernate.hql.internal.CollectionProperties, org.hibernate.hql.internal.antlr.HqlSqlTokenTypes, .SqlTokenTypes, org.hibernate.hql.internal.ast.util.ASTUtil, .ColumnHelper, org.hibernate.internal.CoreLogging, .CoreMessageLogger, org.hibernate.internal.log.DeprecationLogger, org.hibernate.internal.util.StringHelper, org.hibernate.loader.plan.spi.EntityQuerySpace, org.hibernate.persister.collection.QueryableCollection, org.hibernate.persister.entity.AbstractEntityPersister, .EntityPersister, .Queryable, org.hibernate.sql.JoinType, org.hibernate.type.CollectionType, .EntityType, .Type, antlr.SemanticException, antlr.collections.AST

Represents a reference to a property or alias expression. This should duplicate the relevant behaviors in PathExpressionParser.
Author
Joshua Davis

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
public static interface

Field Summary

Modifier and TypeField and Description
private String[]
columns

The column names that this resolves to.

public static final DotNode.IllegalCollectionDereferenceExceptionBuilder
private DotNode.DereferenceType
dereferenceType

The type of dereference that happened

private boolean
fetch

Fetch join or not.

public static DotNode.IllegalCollectionDereferenceExceptionBuilder
private FromElement
impliedJoin

Deprecated as a consequence of FromElement being deprecated.
private JoinType
joinType

The type of join to create.

private static final CoreMessageLogger
private String
path

The full path, to the root alias of this dot node.

private String
propertyName

The identifier that is the name of the property.

private String
propertyPath

The unresolved property path relative to this dot node.

public static boolean
public static boolean
Inherited from org.hibernate.hql.internal.ast.tree.FromReferenceNode:
ROOT_LEVEL

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private boolean
areSame(String alias1, String alias2)

private boolean
canReuse(String classAlias, FromElement fromElement)

Deprecated as a consequence of FromElement being deprecated.
private void
private void
private boolean
private void
dereferenceCollection(CollectionType collectionType, boolean implicitJoin, boolean indexed, String classAlias, AST parent)

private void
private void
dereferenceEntity(EntityType toOneType, boolean implicitJoin, String classAlias, boolean generateJoin, AST parent, AST parentPredicate)

private void
dereferenceEntityIdentifier(String propertyName, DotNode dotParent)

private void
dereferenceEntityJoin(String classAlias, EntityType toOneType, boolean isImpliedJoin, AST parent)

private String[]
public Type
public String
public FromElement
getImpliedJoin()

Overrides org.hibernate.hql.internal.ast.tree.FromReferenceNode.getImpliedJoin.

Deprecated as a consequence of FromElement being deprecated.
Sub-classes can override this method if they produce implied joins (e.g. DotNode).
public FromReferenceNode
public String

Returns:

the full path of the node.
getPath
()

Overrides org.hibernate.hql.internal.ast.tree.FromReferenceNode.getPath.

Implements org.hibernate.hql.internal.ast.tree.PathNode.getPath.

Returns the full path of the node.
public String
public String[]
getReferencedTables()

Implements org.hibernate.hql.internal.ast.tree.TableReferenceNode.getReferencedTables.

Returns table names which are referenced by this node.
private void
private boolean
private static boolean
private boolean

Returns:

True if propertyName references the entity's (owningType->associatedEntity) join key; false otherwise.
isPropertyEmbeddedInJoinProperties
(String
The name of the property to check.
propertyName
)

Is the given property name a reference to the join key of the associated entity constructed by the given entity type?

private Type
public void
resolve(boolean generateJoin, boolean implicitJoin, String classAlias, AST parent, AST parentPredicate)

Implements org.hibernate.hql.internal.ast.tree.ResolvableNode.resolve.

Does the work of resolving an identifier or a dot
public void
public void
resolveIndex(AST parent)

Implements org.hibernate.hql.internal.ast.tree.ResolvableNode.resolveIndex.

Does the work of resolving an index [].
public void
resolveInFunctionCall(boolean generateJoin, boolean implicitJoin)

Overrides org.hibernate.hql.internal.ast.tree.FromReferenceNode.resolveInFunctionCall.

Implements org.hibernate.hql.internal.ast.tree.ResolvableNode.resolveInFunctionCall.

Does the work of resolving inside of the scope of a function call
public void
resolveSelectExpression()

Special method to resolve expressions in the SELECT list.

public void
setFetch(boolean fetch)

private void
setImpliedJoin(FromElement elem)

Deprecated as a consequence of FromElement being deprecated.
public void
setJoinType(JoinType
The type of join to use.
joinType
)

Sets the join type for this '.' node structure.

private void
public void
setPropertyPath(String propertyPath)

public void
public void
setScalarColumnText(int
The index of the select expression in the projection list.
i
)

Implements org.hibernate.hql.internal.ast.tree.SelectExpression.setScalarColumnText.

Appends AST nodes that represent the columns after the current AST node.
Inherited from org.hibernate.hql.internal.ast.tree.FromReferenceNode:
getFromElementisFromElementUpdateOrDeleteRootisResolvedisReturnableEntityprepareForDotrecursiveResolverecursiveResolveresolveresolveresolvesetFromElementsetResolved

Field Detail

columnsback to summary
private String[] columns

The column names that this resolves to.

DEF_ILLEGAL_COLL_DEREF_EXCP_BUILDERback to summary
public static final DotNode.IllegalCollectionDereferenceExceptionBuilder DEF_ILLEGAL_COLL_DEREF_EXCP_BUILDER
dereferenceTypeback to summary
private DotNode.DereferenceType dereferenceType

The type of dereference that happened

fetchback to summary
private boolean fetch

Fetch join or not.

ILLEGAL_COLL_DEREF_EXCP_BUILDERback to summary
public static DotNode.IllegalCollectionDereferenceExceptionBuilder ILLEGAL_COLL_DEREF_EXCP_BUILDER
impliedJoinback to summary
private FromElement impliedJoin

Deprecated

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

joinTypeback to summary
private JoinType joinType

The type of join to create. Default is an inner join.

LOGback to summary
private static final CoreMessageLogger LOG

Hides org.hibernate.hql.internal.ast.tree.FromReferenceNode.LOG.

pathback to summary
private String path

The full path, to the root alias of this dot node.

propertyNameback to summary
private String propertyName

The identifier that is the name of the property.

propertyPathback to summary
private String propertyPath

The unresolved property path relative to this dot node.

regressionStyleJoinSuppressionback to summary
public static boolean regressionStyleJoinSuppression
useThetaStyleImplicitJoinsback to summary
public static boolean useThetaStyleImplicitJoins

Constructor Detail

DotNodeback to summary
public DotNode()

Method Detail

areSameback to summary
private boolean areSame(String alias1, String alias2)
canReuseback to summary
private boolean canReuse(String classAlias, FromElement fromElement)

Deprecated

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

checkForCorrelatedSubqueryback to summary
private void checkForCorrelatedSubquery(String methodName)
checkLhsIsNotCollectionback to summary
private void checkLhsIsNotCollection() throws SemanticException
checkSubclassOrSuperclassPropertyReferenceback to summary
private boolean checkSubclassOrSuperclassPropertyReference(FromReferenceNode lhs, String propertyName)
dereferenceCollectionback to summary
private void dereferenceCollection(CollectionType collectionType, boolean implicitJoin, boolean indexed, String classAlias, AST parent) throws SemanticException
dereferenceComponentback to summary
private void dereferenceComponent(AST parent)
dereferenceEntityback to summary
private void dereferenceEntity(EntityType toOneType, boolean implicitJoin, String classAlias, boolean generateJoin, AST parent, AST parentPredicate) throws SemanticException
dereferenceEntityIdentifierback to summary
private void dereferenceEntityIdentifier(String propertyName, DotNode dotParent)
dereferenceEntityJoinback to summary
private void dereferenceEntityJoin(String classAlias, EntityType toOneType, boolean isImpliedJoin, AST parent) throws SemanticException
getColumnsback to summary
private String[] getColumns() throws QueryException
getDataTypeback to summary
public Type getDataType()

Overrides org.hibernate.hql.internal.ast.tree.SqlNode.getDataType.

Implements org.hibernate.hql.internal.ast.tree.SelectExpression.getDataType.

Doc from org.hibernate.hql.internal.ast.tree.SelectExpression.getDataType.

Returns the data type of the select expression.

Returns:Type

The data type of the select expression.

Annotations
@Override
getDisplayTextback to summary
public String getDisplayText()

Overrides org.hibernate.hql.internal.ast.tree.FromReferenceNode.getDisplayText.

Implements org.hibernate.hql.internal.ast.tree.DisplayableNode.getDisplayText.

Doc from org.hibernate.hql.internal.ast.tree.DisplayableNode.getDisplayText.

Returns additional display text for the AST node.

Returns:String

String - The additional display text.

Annotations
@Override
getImpliedJoinback to summary
public FromElement getImpliedJoin()

Overrides org.hibernate.hql.internal.ast.tree.FromReferenceNode.getImpliedJoin.

Doc from org.hibernate.hql.internal.ast.tree.FromReferenceNode.getImpliedJoin.

Deprecated

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

Sub-classes can override this method if they produce implied joins (e.g. DotNode).

Returns:FromElement

an implied join created by this from reference.

Annotations
@Override
getLhsback to summary
public FromReferenceNode getLhs()
getPathback to summary
public String getPath()

Overrides org.hibernate.hql.internal.ast.tree.FromReferenceNode.getPath.

Implements org.hibernate.hql.internal.ast.tree.PathNode.getPath.

Returns the full path of the node.

Returns:String

the full path of the node.

Annotations
@Override
getPropertyPathback to summary
public String getPropertyPath()
getReferencedTablesback to summary
public String[] getReferencedTables()

Implements org.hibernate.hql.internal.ast.tree.TableReferenceNode.getReferencedTables.

Doc from org.hibernate.hql.internal.ast.tree.TableReferenceNode.getReferencedTables.

Returns table names which are referenced by this node. If the tables can not be determined it returns null.

Returns:String[]

table names or null.

Annotations
@Override
initTextback to summary
private void initText()
isCorrelatedSubselectback to summary
private boolean isCorrelatedSubselect()
isDotNodeback to summary
private static boolean isDotNode(AST n)
isPropertyEmbeddedInJoinPropertiesback to summary
private boolean isPropertyEmbeddedInJoinProperties(String propertyName)

Is the given property name a reference to the join key of the associated entity constructed by the given entity type?

This method resolves the propertyName as a property of the entity type at the propertyPath relative to the FromElement. The implementation does so by invoking FromElement#getPropertyType(String, String), which will resolve the property path against the entity's org.hibernate.persister.entity.PropertyMapping. On initialization of the EntityPersister, this PropertyMapping is filled with property paths for all the owned properties and associations, and (embedded) identifier or unique key properties for owned associations. Henceforth, whenever a property path is found in the PropertyMapping of the EntityPersister of the FromElement, we know that the property corresponds to a SQL fragment producible from the FromElement, and as such the entity property can be dereferenced (optimized) in the final query.

For example, consider a fragment like order.customer.id (where order is a from-element alias). Here, we'd have: propertyName = "id" AND propertyPath = "customer" FromElement = Order and are being asked to determine whether "customer.id" is a property path of Order

Parameters
propertyName:String

The name of the property to check.

Returns:boolean

True if propertyName references the entity's (owningType->associatedEntity) join key; false otherwise.

prepareLhsback to summary
private Type prepareLhs() throws SemanticException
resolveback to summary
public void resolve(boolean generateJoin, boolean implicitJoin, String classAlias, AST parent, AST parentPredicate) throws SemanticException

Implements org.hibernate.hql.internal.ast.tree.ResolvableNode.resolve.

Doc from org.hibernate.hql.internal.ast.tree.ResolvableNode.resolve.

Does the work of resolving an identifier or a dot

resolveFirstChildback to summary
public void resolveFirstChild() throws SemanticException

Overrides org.hibernate.hql.internal.ast.tree.FromReferenceNode.resolveFirstChild.

Resolves the left hand side of the DOT.

Annotations
@Override
resolveIndexback to summary
public void resolveIndex(AST parent) throws SemanticException

Implements org.hibernate.hql.internal.ast.tree.ResolvableNode.resolveIndex.

Doc from org.hibernate.hql.internal.ast.tree.ResolvableNode.resolveIndex.

Does the work of resolving an index [].

resolveInFunctionCallback to summary
public void resolveInFunctionCall(boolean generateJoin, boolean implicitJoin) throws SemanticException

Overrides org.hibernate.hql.internal.ast.tree.FromReferenceNode.resolveInFunctionCall.

Implements org.hibernate.hql.internal.ast.tree.ResolvableNode.resolveInFunctionCall.

Doc from org.hibernate.hql.internal.ast.tree.ResolvableNode.resolveInFunctionCall.

Does the work of resolving inside of the scope of a function call

Annotations
@Override
resolveSelectExpressionback to summary
public void resolveSelectExpression() throws SemanticException

Special method to resolve expressions in the SELECT list.

Exceptions
SemanticException:
if this cannot be resolved.
setFetchback to summary
public void setFetch(boolean fetch)
setImpliedJoinback to summary
private void setImpliedJoin(FromElement elem)

Deprecated

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

setJoinTypeback to summary
public void setJoinType(JoinType joinType)

Sets the join type for this '.' node structure.

Parameters
joinType:JoinType

The type of join to use.

See Also
org.hibernate.sql.JoinFragment
setPropertyNameAndPathback to summary
private void setPropertyNameAndPath(AST parent)
setPropertyPathback to summary
public void setPropertyPath(String propertyPath)
setResolvedConstantback to summary
public void setResolvedConstant(String text)
setScalarColumnTextback to summary
public void setScalarColumnText(int i) throws SemanticException

Implements org.hibernate.hql.internal.ast.tree.SelectExpression.setScalarColumnText.

Doc from org.hibernate.hql.internal.ast.tree.SelectExpression.setScalarColumnText.

Appends AST nodes that represent the columns after the current AST node. (e.g. 'as col0_O_')

Parameters
i:int

The index of the select expression in the projection list.

Exceptions
SemanticException:
if a semantic error occurs
org.hibernate.hql.internal.ast.tree back to summary

public final Enum DotNode.DereferenceType

extends Enum<DotNode.DereferenceType>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final DotNode.DereferenceType
public static final DotNode.DereferenceType
public static final DotNode.DereferenceType
public static final DotNode.DereferenceType
public static final DotNode.DereferenceType
public static final DotNode.DereferenceType
public static final DotNode.DereferenceType

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static DotNode.DereferenceType
public static DotNode.DereferenceType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

COLLECTIONback to summary
public static final DotNode.DereferenceType COLLECTION
COMPONENTback to summary
public static final DotNode.DereferenceType COMPONENT
ENTITYback to summary
public static final DotNode.DereferenceType ENTITY
IDENTIFIERback to summary
public static final DotNode.DereferenceType IDENTIFIER
JAVA_CONSTANTback to summary
public static final DotNode.DereferenceType JAVA_CONSTANT
PRIMITIVEback to summary
public static final DotNode.DereferenceType PRIMITIVE
UNKNOWNback to summary
public static final DotNode.DereferenceType UNKNOWN

Constructor Detail

DereferenceTypeback to summary
private DereferenceType()

Method Detail

valueOfback to summary
public static DotNode.DereferenceType valueOf(String name)
valuesback to summary
public static DotNode.DereferenceType[] values()
org.hibernate.hql.internal.ast.tree back to summary

public Interface DotNode.IllegalCollectionDereferenceExceptionBuilder


Method Summary

Modifier and TypeMethod and Description
public QueryException

Method Detail

buildIllegalCollectionDereferenceExceptionback to summary
public QueryException buildIllegalCollectionDereferenceException(String collectionPropertyName, FromReferenceNode lhs)