Class SimpleFromClauseStateObject
java.lang.Object
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject<VariableDeclarationStateObject>
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractFromClauseStateObject
org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleFromClauseStateObject
- All Implemented Interfaces:
DeclarationStateObject,ListHolderStateObject<VariableDeclarationStateObject>,StateObject
The
FROM clause of a sub-query defines the domain of the sub-query by
declaring identification variables. An identification variable is an identifier declared in the
FROM clause of a sub-query. The domain of the sub-query may be constrained by
path expressions. Identification variables designate instances of a particular entity abstract
schema type. The FROM clause can contain multiple identification variable
declarations separated by a comma (,).
BNF: subquery_from_clause ::= FROM subselect_identification_variable_declaration {, subselect_identification_variable_declaration}*- Since:
- 2.4
- Version:
- 2.4
- See Also:
-
Field Summary
Fields inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractFromClauseStateObject
VARIABLE_DECLARATIONS_LIST -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newSimpleFromClauseStateObject. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(StateObjectVisitor visitor) Visits thisStateObjectby the givenvisitor.Adds a new derived collection declaration to theFROMclause.addDerivedCollectionDeclaration(String collectionValuedPath) Adds a new derived collection declaration to theFROMclause.Adds a new derived identification variable declaration to theFROMclause.addDerivedPathDeclaration(String path, String identificationVariable) Adds a new derived identification variable declaration to theFROMclause.Returns the BNF of the declaration part of this clause.findManagedType(StateObject stateObject) Returns theIManagedTypefor the given identification variable.Returns the actual parsed object if thisStateObjectrepresentation of the JPQL query was created by parsing an existing JPQL query.Returns the parent of thisStateObject.voidsetExpression(SimpleFromClause expression) Keeps a reference of theparsed objectobject, which should only be done when this object is instantiated during the conversion of a parsed JPQL query intoStateObjects.Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractFromClauseStateObject
addCollectionDeclaration, addCollectionDeclaration, addProblems, addRangeDeclaration, addRangeDeclaration, addRangeDeclaration, declarations, findIdentificationVariable, getDeclaration, getManagedType, identificationVariables, isEquivalent, listName, parse, toTextInternalMethods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject
addChildren, addItem, addItems, addListChangeListener, areChildrenEquivalent, canMoveDown, canMoveUp, getItem, hasItems, initialize, items, itemsSize, moveDown, moveUp, removeItem, removeItems, removeListChangeListener, toStringItemsMethods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
acceptUnknownVisitor, acceptUnknownVisitor, addPropertyChangeListener, areEquivalent, buildProblem, buildProblem, buildStateObject, buildStateObjects, checkParent, children, decorate, equals, firePropertyChanged, getChangeSupport, getDecorator, getGrammar, getManagedTypeProvider, getQueryBuilder, getRoot, getType, getType, getTypeHelper, getTypeRepository, hashCode, isDecorated, parent, parent, parent, removePropertyChangeListener, setExpression, setParent, toString, toString, toStringInternal, toStringItems, toTextMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject
addPropertyChangeListener, children, decorate, getDecorator, getGrammar, getManagedTypeProvider, getQueryBuilder, getRoot, isDecorated, removePropertyChangeListener, setParent, toString, toText
-
Constructor Details
-
SimpleFromClauseStateObject
Creates a newSimpleFromClauseStateObject.- Parameters:
parent- The parent of this state object, which cannot benull- Throws:
NullPointerException- The given parent cannot benull
-
-
Method Details
-
accept
Description copied from interface:StateObjectVisits thisStateObjectby the givenvisitor.- Parameters:
visitor- Thevisitorto visit this object
-
addDerivedCollectionDeclaration
Adds a new derived collection declaration to theFROMclause.- Returns:
- The
CollectionMemberDeclarationStateObjectrepresenting the collection declaration
-
addDerivedCollectionDeclaration
public CollectionMemberDeclarationStateObject addDerivedCollectionDeclaration(String collectionValuedPath) Adds a new derived collection declaration to theFROMclause.- Parameters:
collectionValuedPath- The collection-valued path expression- Returns:
- The
CollectionMemberDeclarationStateObjectrepresenting the collection declaration
-
addDerivedPathDeclaration
Adds a new derived identification variable declaration to theFROMclause.- Returns:
- The
DerivedPathIdentificationVariableDeclarationStateObjectrepresenting the path declaration
-
addDerivedPathDeclaration
public DerivedPathIdentificationVariableDeclarationStateObject addDerivedPathDeclaration(String path, String identificationVariable) Adds a new derived identification variable declaration to theFROMclause.- Parameters:
path- Either the derived singled-valued object field or the collection-valued path expressionidentificationVariable- The identification variable defining the given path- Returns:
- The
DerivedPathIdentificationVariableDeclarationStateObjectrepresenting the path declaration
-
declarationBNF
Description copied from class:AbstractFromClauseStateObjectReturns the BNF of the declaration part of this clause.- Specified by:
declarationBNFin classAbstractFromClauseStateObject- Returns:
- The BNF of the declaration part of this clause
-
findManagedType
Description copied from interface:DeclarationStateObjectReturns theIManagedTypefor the given identification variable. If the declaration is for a subquery and there is no managed type associated with the identification then the search will traverse up the query hierarchy.
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- TheStateObjectthat should be an simple identification variable or an encapsulated identification variable with the identifierKEYorVALUE- Returns:
- The
IManagedTyperepresenting the domain object declared by the given identification variable - See Also:
-
getExpression
Description copied from interface:StateObjectReturns the actual parsed object if thisStateObjectrepresentation of the JPQL query was created by parsing an existing JPQL query.- Specified by:
getExpressionin interfaceStateObject- Overrides:
getExpressionin classAbstractFromClauseStateObject- Returns:
- The parsed object when a JPQL query is parsed and converted into a
StateObjectornullwhen the JPQL query is manually created (i.e. not from a string)
-
getParent
Description copied from interface:StateObjectReturns the parent of thisStateObject.- Specified by:
getParentin interfaceStateObject- Overrides:
getParentin classAbstractFromClauseStateObject- Returns:
- Returns the parent of this
StateObject, which isnullonly when this is the root of the hierarchy
-
setExpression
Keeps a reference of theparsed objectobject, which should only be done when this object is instantiated during the conversion of a parsed JPQL query intoStateObjects.- Parameters:
expression- Theparsed objectrepresenting a subqueryFROMclause
-