EJBQLParseTreepublic class EJBQLParseTree extends ParseTree INTERNAL
Purpose: This represents an EJBQL parse tre
Responsibilities:
- Maintain the context for the expression generation
- Build an initial expression
- Return a reference class for the expression
- Maintain the root node for the query
|
Constructors Summary |
---|
public EJBQLParseTree()EJBQLParseTree constructor comment.
super();
|
Methods Summary |
---|
public oracle.toplink.essentials.internal.parsing.GenerationContext | buildContext(oracle.toplink.essentials.queryframework.ReadQuery readQuery, oracle.toplink.essentials.internal.sessions.AbstractSession session)INTERNAL
Build the context to be used when generating the expression from the parse tree
GenerationContext contextForGeneration = super.buildContext(readQuery, session);
contextForGeneration.setBaseQueryClass(readQuery.getReferenceClass());
return contextForGeneration;
| private oracle.toplink.essentials.internal.parsing.GenerationContext | buildSubqueryContext(oracle.toplink.essentials.queryframework.ReadQuery readQuery, oracle.toplink.essentials.internal.parsing.GenerationContext outer)INTERNAL
Build the context to be used when generating the expression from the
subquery parse tree.
GenerationContext context = new SelectGenerationContext(outer, this);
context.setBaseQueryClass(readQuery.getReferenceClass());
return context;
| private void | populateModifyQueryInternal(oracle.toplink.essentials.queryframework.ModifyAllQuery query, oracle.toplink.essentials.internal.parsing.GenerationContext generationContext)
if (query.getReferenceClass() == null) {
// Adjust the reference class if necessary
adjustReferenceClassForQuery(query, generationContext);
}
query.setSession(generationContext.getSession());
// Initialize the base expression in the generation context
initBaseExpression(query, generationContext);
// Validate parse tree
validate(generationContext.getSession(), getClassLoader());
// Apply the query node to the query
applyQueryNodeToQuery(query, generationContext);
setSelectionCriteriaForQuery(query, generationContext);
| public void | populateQuery(oracle.toplink.essentials.queryframework.DatabaseQuery query, oracle.toplink.essentials.internal.sessions.AbstractSession session)Add all of the relevant query settings from an EJBQLParseTree to the given
database query.
if (query.isObjectLevelReadQuery()) {
ObjectLevelReadQuery objectQuery = (ObjectLevelReadQuery)query;
GenerationContext generationContext = buildContext(objectQuery, session);
populateReadQueryInternal(objectQuery, generationContext);
} else if (query.isUpdateAllQuery()) {
UpdateAllQuery updateQuery = (UpdateAllQuery)query;
GenerationContext generationContext = buildContext(updateQuery, session);
populateModifyQueryInternal(updateQuery, generationContext);
addUpdatesToQuery(updateQuery, generationContext);
} else if (query.isDeleteAllQuery()) {
DeleteAllQuery deleteQuery = (DeleteAllQuery)query;
GenerationContext generationContext = buildContext(deleteQuery, session);
populateModifyQueryInternal(deleteQuery, generationContext);
}
| private void | populateReadQueryInternal(oracle.toplink.essentials.queryframework.ObjectLevelReadQuery objectQuery, oracle.toplink.essentials.internal.parsing.GenerationContext generationContext)
// Get the reference class if it does not exist. This is done
// for dynamic queries in EJBQL 3.0
if (objectQuery.getReferenceClass() == null) {
// Adjust the reference class if necessary
adjustReferenceClassForQuery(objectQuery, generationContext);
}
// Initialize the base expression in the generation context
initBaseExpression(objectQuery, generationContext);
// Validate parse tree
validate(generationContext.getSession(), getClassLoader());
// Apply the query node to the query (this will be a SelectNode for a read query)
applyQueryNodeToQuery(objectQuery, generationContext);
// Verify the SELECT is valid (valid alias, etc)
verifySelect(objectQuery, generationContext);
// This is what it's all about...
setSelectionCriteriaForQuery(objectQuery, generationContext);
// Add any ordering
addOrderingToQuery(objectQuery, generationContext);
// Add any grouping
addGroupingToQuery(objectQuery, generationContext);
// Add having
addHavingToQuery(objectQuery, generationContext);
// Add non fetch joined variables
addNonFetchJoinAttributes(objectQuery, generationContext);
| public oracle.toplink.essentials.internal.parsing.GenerationContext | populateSubquery(oracle.toplink.essentials.queryframework.ObjectLevelReadQuery readQuery, oracle.toplink.essentials.internal.parsing.GenerationContext outer)Add all of the relevant query settings from an EJBQLParseTree to the given
database query.
GenerationContext innerContext = buildSubqueryContext(readQuery, outer);
populateReadQueryInternal(readQuery, innerContext);
return innerContext;
|
|