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

public Class DotNode

extends FromReferenceNode
implements DisplayableNode, SelectExpression
Class Inheritance
All Implemented Interfaces
org.hibernate.hql.ast.tree.SelectExpression, org.hibernate.hql.ast.tree.DisplayableNode
Imports
org.hibernate.QueryException, org.hibernate.engine.JoinSequence, org.hibernate.hql.CollectionProperties, org.hibernate.hql.antlr.SqlTokenTypes, org.hibernate.hql.ast.util.ASTUtil, .ColumnHelper, org.hibernate.persister.collection.QueryableCollection, org.hibernate.persister.entity.EntityPersister, org.hibernate.sql.JoinFragment, org.hibernate.type.CollectionType, .EntityType, .Type, org.hibernate.util.StringHelper, antlr.SemanticException, antlr.collections.AST, org.slf4j.Logger, .LoggerFactory

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 interface

Field Summary

Modifier and TypeField and Description
private String[]
columns

The column names that this resolves to.

public static final DotNode.IllegalCollectionDereferenceExceptionBuilder
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private int
dereferenceType

The type of dereference that hapened (DEREF_xxx).

private boolean
fetch

Fetch join or not.

public static DotNode.IllegalCollectionDereferenceExceptionBuilder
private FromElement
impliedJoin

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

The type of join to create.

private static final Logger
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.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 void
private void
private boolean
private void
dereferenceCollection(CollectionType collectionType, boolean implicitJoin, boolean indexed, String classAlias, AST parent)

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

private void
dereferenceEntityIdentifier(String propertyName, DotNode dotParent)

private void
dereferenceEntityJoin(String classAlias, EntityType propertyType, boolean impliedJoin, AST parent)

private String[]
public Type
getDataType()

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

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

Returns the data type of the select expression.
public String
public FromElement
getImpliedJoin()

Overrides org.hibernate.hql.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.ast.tree.FromReferenceNode.getPath.

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

Returns the full path of the node.
public String
private void
private boolean
private boolean
private boolean

Returns:

True if propertyName references the entity's (owningType->associatedEntity) primary key; false otherwise.
isReferenceToPrimaryKey
(String
The name of the property to check.
propertyName
,
EntityType
The type represeting the entity "owning" the property
owningType
)

Is the given property name a reference to the primary key of the associated entity construed by the given entity type?

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

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

Does the work of resolving an identifier or a dot
public void
resolveFirstChild()

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

Resolves the left hand side of the DOT.
public void
resolveIndex(AST parent)

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

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

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

Implements org.hibernate.hql.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(int
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.ast.tree.SelectExpression.setScalarColumnText.

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

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
DEREF_COLLECTIONback to summary
private static final int DEREF_COLLECTION
DEREF_COMPONENTback to summary
private static final int DEREF_COMPONENT
DEREF_ENTITYback to summary
private static final int DEREF_ENTITY
DEREF_IDENTIFIERback to summary
private static final int DEREF_IDENTIFIER
DEREF_JAVA_CONSTANTback to summary
private static final int DEREF_JAVA_CONSTANT
DEREF_PRIMITIVEback to summary
private static final int DEREF_PRIMITIVE
DEREF_UNKNOWNback to summary
private static final int DEREF_UNKNOWN
dereferenceTypeback to summary
private int dereferenceType

The type of dereference that hapened (DEREF_xxx).

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 int joinType

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

logback to summary
private static final Logger log

Hides org.hibernate.hql.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.

REGRESSION_STYLE_JOIN_SUPPRESSIONback to summary
public static boolean REGRESSION_STYLE_JOIN_SUPPRESSION
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)
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 entityType, boolean implicitJoin, String classAlias, boolean generateJoin, AST parent) throws SemanticException
dereferenceEntityIdentifierback to summary
private void dereferenceEntityIdentifier(String propertyName, DotNode dotParent)
dereferenceEntityJoinback to summary
private void dereferenceEntityJoin(String classAlias, EntityType propertyType, boolean impliedJoin, AST parent) throws SemanticException
getColumnsback to summary
private String[] getColumns() throws QueryException
getDataTypeback to summary
public Type getDataType()

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

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

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

Returns the data type of the select expression.

Returns:Type

The data type of the select expression.

getDisplayTextback to summary
public String getDisplayText()

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

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

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

Returns additional display text for the AST node.

Returns:String

String - The additional display text.

getImpliedJoinback to summary
public FromElement getImpliedJoin()

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

Doc from org.hibernate.hql.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.

getLhsback to summary
public FromReferenceNode getLhs()
getPathback to summary
public String getPath()

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

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

Returns the full path of the node.

Returns:String

the full path of the node.

getPropertyPathback to summary
public String getPropertyPath()
initTextback to summary
private void initText()
isCorrelatedSubselectback to summary
private boolean isCorrelatedSubselect()
isDotNodeback to summary
private boolean isDotNode(AST n)
isReferenceToPrimaryKeyback to summary
private boolean isReferenceToPrimaryKey(String propertyName, EntityType owningType)

Is the given property name a reference to the primary key of the associated entity construed by the given entity type?

For example, consider a fragment like order.customer.id (where order is a from-element alias). Here, we'd have: propertyName = "id" AND owningType = ManyToOneType(Customer) and are being asked to determine whether "customer.id" is a reference to customer's PK...

Parameters
propertyName:String

The name of the property to check.

owningType:EntityType

The type represeting the entity "owning" the property

Returns:boolean

True if propertyName references the entity's (owningType->associatedEntity) primary 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) throws SemanticException

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

Doc from org.hibernate.hql.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.ast.tree.FromReferenceNode.resolveFirstChild.

Resolves the left hand side of the DOT.

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

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

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

Does the work of resolving an an index [].

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

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

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

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

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

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(int joinType)

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

Parameters
joinType:int

The type of join to use.

See Also
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.ast.tree.SelectExpression.setScalarColumnText.

Doc from org.hibernate.hql.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.

org.hibernate.hql.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)