public class SelectNode extends QueryNode
Purpose: Represent a SELECT
Responsibilities:
The SELECT statement determines the return type of an EJBQL query. The SELECT may also determine the distinct state of a query A SELECT can be one of the following:
1. SELECT OBJECT(someObject)... This query will return a collection of objects
2. SELECT anObject.anAttribute ... This will return a collection of anAttribute
3. SELECT <aggregateFunction> ... This will return a single value
The allowable aggregateFunctions are: AVG, COUNT, MAX, MIN, SUM
SELECT AVG(emp.salary)... Returns the average of all the employees salaries
SELECT COUNT(emp)... Returns a count of the employees
SELECT COUNT(emp.firstName)... Returns a count of the employee's firstNames
SELECT MAX(emp.salary)... Returns the maximum employee salary
SELECT MIN(emp.salary)... Returns the minimum employee salary
SELECT SUM(emp.salary)... Returns the sum of all the employees salaries
shouldGenerateExpression| Constructor and Description |
|---|
SelectNode() |
| Modifier and Type | Method and Description |
|---|---|
void |
applyToQuery(DatabaseQuery theQuery,
GenerationContext context)
INTERNAL
Apply this node to the passed query
|
DatabaseQuery |
createDatabaseQuery(ParseTreeContext context)
Returns a DatabaseQuery instance representing the owning
ParseTree.
|
Expression |
generateExpression(GenerationContext context)
Return a EclipseLink expression generated using the left node.
|
java.util.List |
getIdentifiers() |
java.lang.Class |
getReferenceClass(GenerationContext context)
Compute the Reference class for this query.
|
java.util.List |
getSelectExpressions() |
boolean |
hasOneToOneSelected(GenerationContext context) |
boolean |
isSelected(java.lang.String variableName)
Answer true if the variable name given as argument is SELECTed.
|
boolean |
isSelectNode() |
boolean |
isVariableInINClauseSelected(GenerationContext context)
Answer true if a variable in the IN clause is SELECTed
|
boolean |
nodeRefersToObject(Node node,
GenerationContext context)
Answer true if this node refers to an object described later in the EJBQL
True: SELECT p FROM Project p
False: SELECT p.id FROM Project p
|
Node |
qualifyAttributeAccess(ParseTreeContext context)
Check the select expression nodes for a path expression starting with a
unqualified field access and if so, replace it by a qualified field
access.
|
java.lang.Class |
resolveClass(GenerationContext context)
Answer the class associated with my left node.
|
void |
setDistinct(boolean distinct) |
void |
setIdentifiers(java.util.List identifiers) |
void |
setSelectExpressions(java.util.List exprs) |
boolean |
usesDistinct() |
void |
validate(ParseTreeContext context)
Validate node.
|
void |
verifySelectedAlias(GenerationContext context)
Verify that the selected alias is a valid alias.
|
getParseTree, isDeleteNode, isUpdateNode, setParseTreegetContext, setContextaddToExpression, appendExpression, applyToQuery, getAlias, getAsString, getColumn, getLeft, getLine, getRight, getType, hasLeft, hasRight, isAggregateNode, isAliasableNode, isAttributeNode, isConstructorNode, isCountNode, isDivideNode, isDotNode, isEscape, isLiteralNode, isMapKeyNode, isMinusNode, isMultiplyNode, isNotNode, isParameterNode, isPlusNode, isSubqueryNode, isVariableNode, resolveAttribute, resolveClass, resolveMapping, resolveMapping, setAlias, setColumn, setLeft, setLine, setRight, setType, toString, toString, toStringDisplayName, toStringIndent, validateParameterpublic java.util.List getSelectExpressions()
public void setSelectExpressions(java.util.List exprs)
public java.util.List getIdentifiers()
public void setIdentifiers(java.util.List identifiers)
public boolean usesDistinct()
public void setDistinct(boolean distinct)
public DatabaseQuery createDatabaseQuery(ParseTreeContext context)
createDatabaseQuery in class QueryNodepublic void applyToQuery(DatabaseQuery theQuery, GenerationContext context)
applyToQuery in class QueryNodepublic boolean hasOneToOneSelected(GenerationContext context)
public void verifySelectedAlias(GenerationContext context)
public boolean isSelected(java.lang.String variableName)
public boolean isSelectNode()
isSelectNode in class QueryNodepublic Node qualifyAttributeAccess(ParseTreeContext context)
qualifyAttributeAccess in class Nodepublic void validate(ParseTreeContext context)
public java.lang.Class resolveClass(GenerationContext context)
resolveClass in class QueryNodepublic Expression generateExpression(GenerationContext context)
generateExpression in class QueryNodepublic java.lang.Class getReferenceClass(GenerationContext context)
getReferenceClass in class QueryNodepublic boolean isVariableInINClauseSelected(GenerationContext context)
public boolean nodeRefersToObject(Node node, GenerationContext context)
EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference