Class IdentificationVariableDeclarationStateObject
java.lang.Object
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject<JoinStateObject>
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractIdentificationVariableDeclarationStateObject
org.eclipse.persistence.jpa.jpql.tools.model.query.IdentificationVariableDeclarationStateObject
- All Implemented Interfaces:
ListHolderStateObject<JoinStateObject>
,StateObject
,VariableDeclarationStateObject
public class IdentificationVariableDeclarationStateObject
extends AbstractIdentificationVariableDeclarationStateObject
An identification variable is a valid identifier declared in the
FROM
clause
of a query. All identification variables must be declared in the FROM
clause.
Identification variables cannot be declared in other clauses. An identification variable must not
be a reserved identifier or have the same name as any entity in the same persistence unit:
Identification variables are case insensitive. An identification variable evaluates to a value of
the type of the expression used in declaring the variable.
BNF: identification_variable_declaration ::= range_variable_declaration { join | fetch_join }*
- Since:
- 2.4
- Version:
- 2.4
- See Also:
-
Field Summary
Fields inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractIdentificationVariableDeclarationStateObject
JOINS_LIST
-
Constructor Summary
ConstructorDescriptionCreates a newIdentificationVariableDeclarationStateObject
.IdentificationVariableDeclarationStateObject
(AbstractFromClauseStateObject parent, String entityName, String identificationVariable) Creates a newIdentificationVariableDeclarationStateObject
.IdentificationVariableDeclarationStateObject
(AbstractFromClauseStateObject parent, IEntity entity, String identificationVariable) Creates a newIdentificationVariableDeclarationStateObject
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(StateObjectVisitor visitor) Visits thisStateObject
by the givenvisitor
.addInnerJoinFetch
(String path) Adds a newINNER JOIN FETCH
expression to this declaration.addJoinFetch
(String path) Adds a newJOIN FETCH
expression to this declaration.addJoinFetch
(String joinFetchType, String path) Adds a newJOIN FETCH
expression to this declaration.addJoinFetch
(String joinFetchType, ListIterator<String> paths) Adds a newJOIN FETCH
expression to this declaration.addJoinFetchType
(String joinFetchType) Adds a newJOIN FETCH
expression to this declaration.addLeftJoinFetch
(String path) Adds a newLEFT JOIN FETCH
expression to this declaration.addLeftOuterJoinFetch
(String path) Adds a newLEFT OUTER JOIN FETCH
expression to this declaration.CreatesReturns the actual external form representing theIEntity
.Returns the name of the entity for which it is used as the "root" of the declaration.getManagedType
(StateObject stateObject) Returns theIManagedType
for the given identification variable.Returns theStateObject
representing the range variable declaration portion.Returns theStateObject
representing the "root" for objects which may not be reachable by navigation.protected String
listName()
Returns the name that is uniquely identifying the list.void
Sets theIEntity
as the "root".void
setEntityName
(String entityName) Sets the name of the abstract schema, which is the name of the entity.Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractIdentificationVariableDeclarationStateObject
addChildren, addInnerJoin, addJoin, addJoin, addJoin, addJoin, addLeftJoin, addLeftOuterJoin, getExpression, getIdentificationVariable, getIdentificationVariableStateObject, getParent, getRootPath, identificationVariables, initialize, isEquivalent, parseJoin, setExpression, setIdentificationVariable, setRootPath, toTextInternal
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject
addItem, addItems, addListChangeListener, areChildrenEquivalent, canMoveDown, canMoveUp, getItem, hasItems, items, itemsSize, moveDown, moveUp, removeItem, removeItems, removeListChangeListener, toStringItems
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
acceptUnknownVisitor, acceptUnknownVisitor, addProblems, addPropertyChangeListener, areEquivalent, buildProblem, buildProblem, buildStateObject, buildStateObjects, checkParent, children, decorate, equals, findIdentificationVariable, firePropertyChanged, getChangeSupport, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getQueryBuilder, getRoot, getType, getType, getTypeHelper, getTypeRepository, hashCode, isDecorated, parent, parent, parent, removePropertyChangeListener, setExpression, setParent, toString, toString, toStringInternal, toStringItems, toText
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject
addPropertyChangeListener, children, decorate, findIdentificationVariable, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getQueryBuilder, getRoot, isDecorated, removePropertyChangeListener, setParent, toString, toText
-
Constructor Details
-
IdentificationVariableDeclarationStateObject
Creates a newIdentificationVariableDeclarationStateObject
.- Parameters:
parent
- The parent of this state object, which cannot benull
- Throws:
NullPointerException
- The given parent cannot benull
-
IdentificationVariableDeclarationStateObject
public IdentificationVariableDeclarationStateObject(AbstractFromClauseStateObject parent, IEntity entity, String identificationVariable) Creates a newIdentificationVariableDeclarationStateObject
.- Parameters:
parent
- The parent of this state object, which cannot benull
entity
- The external form of the entity to add to the declaration listidentificationVariable
- The unique identifier identifying the abstract schema name- Throws:
NullPointerException
- The given parent cannot benull
-
IdentificationVariableDeclarationStateObject
public IdentificationVariableDeclarationStateObject(AbstractFromClauseStateObject parent, String entityName, String identificationVariable) Creates a newIdentificationVariableDeclarationStateObject
.- Parameters:
parent
- The parent of this state object, which cannot benull
entityName
- The name of the entity nameidentificationVariable
- The new identification variable- Throws:
NullPointerException
- The given parent cannot benull
-
-
Method Details
-
accept
Description copied from interface:StateObject
Visits thisStateObject
by the givenvisitor
.- Parameters:
visitor
- Thevisitor
to visit this object
-
addInnerJoinFetch
Adds a newINNER JOIN FETCH
expression to this declaration.- Parameters:
path
- The join association path expression- Returns:
- A new
JoinStateObject
-
addJoinFetch
Adds a newJOIN FETCH
expression to this declaration.- Parameters:
path
- The join association path expression- Returns:
- A new
JoinStateObject
-
addJoinFetch
Adds a newJOIN FETCH
expression to this declaration.- Parameters:
joinFetchType
- One of the joining types:LEFT JOIN FETCH
,LEFT OUTER JOIN FETCH
,INNER JOIN FETCH
orJOIN FETCH
paths
- The join association path expression- Returns:
- A new
JoinStateObject
-
addJoinFetch
Adds a newJOIN FETCH
expression to this declaration.- Parameters:
joinFetchType
- One of the joining types:LEFT JOIN FETCH
,LEFT OUTER JOIN FETCH
,INNER JOIN FETCH
orJOIN FETCH
path
- The join association path expression- Returns:
- A new
JoinStateObject
-
addJoinFetchType
Adds a newJOIN FETCH
expression to this declaration.- Parameters:
joinFetchType
- One of the joining types:LEFT JOIN FETCH
,LEFT OUTER JOIN FETCH
,INNER JOIN FETCH
orJOIN FETCH
- Returns:
- A new
JoinStateObject
-
addLeftJoinFetch
Adds a newLEFT JOIN FETCH
expression to this declaration.- Parameters:
path
- The join association path expression- Returns:
- A new
JoinStateObject
-
addLeftOuterJoinFetch
Adds a newLEFT OUTER JOIN FETCH
expression to this declaration.- Parameters:
path
- The join association path expression- Returns:
- A new
JoinStateObject
-
buildRangeVariableDeclarationStateObject
Description copied from class:AbstractIdentificationVariableDeclarationStateObject
Creates- Specified by:
buildRangeVariableDeclarationStateObject
in classAbstractIdentificationVariableDeclarationStateObject
-
getEntity
Returns the actual external form representing theIEntity
.- Returns:
- The actual
IEntity
ornull
if no entity exists with the entity name
-
getEntityName
Returns the name of the entity for which it is used as the "root" of the declaration.- Returns:
- The name of the entity
-
getManagedType
Description copied from interface:VariableDeclarationStateObject
Returns theIManagedType
for the given identification variable. The search does not traverse up the query hierarchy if this declaration is for a subquery.
In the above query, the managed type associated with the identification variable:SELECT e FROM Department d JOIN KEY(d.employees).addresses a
- d is "Department"
- a is "Address"
- Parameters:
stateObject
- TheStateObject
that should be an simple identification variable or an encapsulated identification variable with the identifierKEY
orVALUE
- Returns:
- The
IManagedType
representing the domain object declared by the given identification variable
-
getRangeVariableDeclaration
Description copied from class:AbstractIdentificationVariableDeclarationStateObject
Returns theStateObject
representing the range variable declaration portion.- Overrides:
getRangeVariableDeclaration
in classAbstractIdentificationVariableDeclarationStateObject
- Returns:
- The concrete instance
-
getRootStateObject
Description copied from class:AbstractIdentificationVariableDeclarationStateObject
Returns theStateObject
representing the "root" for objects which may not be reachable by navigation.- Overrides:
getRootStateObject
in classAbstractIdentificationVariableDeclarationStateObject
- Returns:
- The
StateObject
representing one of the possible valid "root"
-
listName
Description copied from class:AbstractListHolderStateObject
Returns the name that is uniquely identifying the list.- Overrides:
listName
in classAbstractIdentificationVariableDeclarationStateObject
- Returns:
- The unique name identifying the list
-
setEntity
Sets theIEntity
as the "root".- Parameters:
entity
- TheIEntity
itself
-
setEntityName
Sets the name of the abstract schema, which is the name of the entity.- Parameters:
entityName
- The name of the entity
-