Module org.eclipse.persistence.core
Class SQLSelectStatement
java.lang.Object
org.eclipse.persistence.internal.expressions.SQLStatement
org.eclipse.persistence.internal.expressions.SQLSelectStatement
- All Implemented Interfaces:
Serializable
,Cloneable
Purpose: Print SELECT statement.
Responsibilities:
- Print SELECT statement.
- Since:
- TOPLink/Java 1.0
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected Expression
protected DatabaseTable
protected int
protected ReadAllQuery.Direction
protected short
Used for "Select Distinct" option.protected Map
<DatabaseField, String> Used for caching the field alias written to the queryprotected int
Counter to generate unique alias namesprotected Vector
Fields being selected (can include expressions).protected ForUpdateClause
Used for pessimistic locking ie.protected List
<Expression> Group by clause for report queries.protected Expression
Having clause for report queries.protected boolean
Used for report query or counts so we know how to treat distincts.protected DatabaseTable
Fields not being selected (can include expressions).protected Map
<Expression, Expression> It is used by subselect to re-normalize joinsprotected List
<Expression> Order by clause for read all queries.protected List
<Expression> protected List
<OuterJoinExpressionHolder> Used for DB2 style from clause outer joins.protected SQLSelectStatement
Used for subselects.protected ReadQuery
Query this statement is associated to (used for SQL query options).protected boolean
Variables used for aliasing and normalizing.protected boolean
protected Expression
Used for Oracle Hierarchical Queriesprotected Map
<DatabaseTable, DatabaseTable> protected List
<DatabaseTable> Tables being selected from.protected List
<Expression> Union clause.protected boolean
Flag used to indicate field names should use unique aliasesFields inherited from class org.eclipse.persistence.internal.expressions.SQLStatement
builder, hintString, translationRow, whereClause
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addField
(Expression expression) INTERNAL: adds an expression to the fields.void
addField
(DatabaseField field) void
addOptimizedClonedExpressions
(Expression originalKey, Expression optimizedValue) INTERNAL: It is used by subqueries to avoid duplicate joins.protected void
When distinct is used with order by the ordered fields must be in the select clause.addOuterJoinExpressionsHolders
(Map<DatabaseTable, Expression> outerJoinedAdditionalJoinCriteria, ClassDescriptor descriptor) INTERNAL: used by TREAT to add in a join from the parent table to the child tables when the parent expression did not add an outer join of its ownaddOuterJoinExpressionsHolders
(ObjectExpression joinExpression, Expression outerJoinedMappingCriteria, Map<DatabaseTable, Expression> outerJoinedAdditionalJoinCriteria, ClassDescriptor descriptor) INTERNAL: Used by ExpressionBuilder and QueryKeyExpression normalization to create a standard outerjoin.void
addTable
(DatabaseTable table) Add a table to the statement.void
This method will append the for update clause to the end of the select statement.void
appendFromClauseForInformixOuterJoin
(ExpressionSQLPrinter printer, List<DatabaseTable> outerJoinedAliases) ADVANCED: If a platform is Informix, then the outer join must be in the FROM clause.void
appendFromClauseForOuterJoin
(ExpressionSQLPrinter printer, List<DatabaseTable> outerJoinedAliases, Collection aliasesOfTablesToBeLocked, boolean shouldPrintUpdateClauseForAllTables) ADVANCED: Appends the SQL standard outer join clause, and some variation per platform.void
Print the from clause.void
This method will append the group by clause to the end of the select statement.void
This method will append the Hierarchical Query Clause to the end of the select statementvoid
This method will append the order clause to the end of the select statement.void
This method will append the union clause to the end of the select statement.void
assignAliases
(Vector allExpressions) INTERNAL: Alias the tables in all of our nodes.buildCall
(AbstractSession session) Print the SQL representation of the statement on a stream.buildCall
(AbstractSession session, DatabaseQuery query) Build the call, setting the query first, this is required in some cases when the query info is required to print the SQL.void
INTERNAL: This is used by cursored stream to determine if an expression used distinct as the size must account for this.void
INTERNAL: Computes all aliases which will appear in the FROM clause.void
If there is no where clause, alias the tables from the tables list directly.void
ADVANCED: If a distinct has been set the DISTINCT clause will be printed.void
protected boolean
fieldsContainField
(List fields, Expression expression) Check if the field from the field expression is already contained in the select clause of the statement.generatedAlias
(String fieldName) Returns a generated alias based on the column name.getAliasFor
(DatabaseField field) INTERNAL: Return the CONNECT BY expressionint
Gets a unique id that will be used to alias the next table.INTERNAL:INTERNAL: Return all the fieldsprotected ForUpdateClause
INTERNAL: Return the group bys.INTERNAL: Return the having expression.int
INTERNAL: Return the next value of fieldCounterReturn the fields we don't want to select but want to join on.INTERNAL: It is used by subqueries to avoid duplicate joins.INTERNAL: Return the order expressions for the query.INTERNAL: Return the ORDER SIBLINGS BY expressionINTERNAL: returns outerJoinExpressionHolders representing outerjoin expressions.Return the parent statement if using subselects.getQuery()
INTERNAL: Query held as it may store properties needed to generate the SQLINTERNAL: Return the StartWith expressionINTERNAL: Return the aliases used.INTERNAL: Return all the tables.boolean
INTERNAL: Return True if unique field aliases will be generated of the form "fieldname AS fieldnameX", False otherwise.protected boolean
hasAliasForTable
(DatabaseTable table) boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
INTERNAL:boolean
INTERNAL: return true if this query has computed its distinct value alreadyboolean
static SortedSet
mapTableIndexToExpression
(Expression expression, TreeMap map, List<DatabaseTable> tablesInOrder) INTERNAL: The method searches for expressions that join two tables each in a given expression.static Map
mapTableToExpression
(Expression expression, Vector tablesInOrder) INTERNAL: The method searches for expressions that join two tables each in a given expression.final void
normalize
(AbstractSession session, ClassDescriptor descriptor) INTERNAL: Normalize an expression into a printable structure.void
normalize
(AbstractSession session, ClassDescriptor descriptor, Map clonedExpressions) INTERNAL: Normalize an expression into a printable structure.void
normalizeForView
(AbstractSession theSession, ClassDescriptor theDescriptor, Map clonedExpressions) INTERNAL: Normalize an expression mapping all of the descriptor's tables to the view.protected void
normalizeOrderBy
(Expression builder, List<Expression> allExpressions, Map<Expression, Expression> clonedExpressions, AbstractSession session) Check the order by for object expressions.protected void
printForUpdateClauseOnJoin
(DatabaseTable alias, ExpressionSQLPrinter printer, boolean shouldPrintUpdateClauseForAllTables, Collection aliasesOfTablesToBeLocked, DatabasePlatform platform) Print the FOR UPDATE clause after each join if required.protected void
printOnClause
(Expression onClause, ExpressionSQLPrinter printer, DatabasePlatform platform) Print the outer join ON clause.printSQL
(ExpressionSQLPrinter printer) Print the SQL representation of the statement on a stream.void
void
void
printSQLHavingClause
(ExpressionSQLPrinter printer) void
void
printSQLSelect
(ExpressionSQLPrinter printer) void
printSQLUnionClause
(ExpressionSQLPrinter printer) void
printSQLWhereClause
(ExpressionSQLPrinter printer) void
printSQLWhereKeyWord
(ExpressionSQLPrinter printer) void
rebuildAndAddExpressions
(List expressions, List allExpressions, ExpressionBuilder primaryBuilder, Map clonedExpressions) Rebuild the expressions with the correct expression builder if using a different one.void
rebuildAndAddExpressions
(Map expressions, Vector allExpressions, ExpressionBuilder primaryBuilder, Map clonedExpressions) Rebuild the expressions with the correct expression builder if using a different one.rebuildExpression
(Expression expression, Expression primaryBuilder, Map<Expression, Expression> clonedExpressions) Rebuild the expression if required.void
removeField
(DatabaseField field) INTERNAL:void
removeTable
(DatabaseTable table) Remove a table from the statement.boolean
INTERNAL: Returns true if aliases are required, false otherwise.void
ADVANCED: If a distinct has been set the DISTINCT clause will be printed.void
setBuilder
(ExpressionBuilder builder) void
setCurrentAliasNumber
(int currentAliasNumber) Sets a unique id that will be used to alias the next table.void
setDistinctState
(short distinctState) ADVANCED: If a distinct has been set the DISTINCT clause will be printed.void
INTERNAL: Set the fields, if any are aggregate selects then record this so that the distinct is not printed through anyOfs.protected void
setForUpdateClause
(ForUpdateClause clause) void
setGroupByExpressions
(List<Expression> expressions) void
setHavingExpression
(Expression expressions) void
setHierarchicalQueryExpressions
(Expression startWith, Expression connectBy, List<Expression> orderSiblingsExpressions) INTERNAL: takes the hierarchical query expression which have been set on the query and sets them here used to generate the Hierarchical Query Clause in the SQLvoid
setHierarchicalQueryExpressions
(Expression startWith, Expression connectBy, List<Expression> orderSiblingsExpressions, ReadAllQuery.Direction direction) INTERNAL: takes the hierarchical query expression which have been set on the query and sets them here used to generate the Hierarchical Query Clause in the SQLvoid
setIsAggregateSelect
(boolean isAggregateSelect) void
setLockingClause
(ForUpdateClause lockingClause) void
setNonSelectFields
(List nonSelectFields) Set the non select fields.void
setNormalizedWhereClause
(Expression whereClause) Set the where clause expression.void
setOrderByExpressions
(List<Expression> orderByExpressions) void
setParentStatement
(SQLSelectStatement parentStatement) Set the parent statement if using subselects.void
Query held as it may store properties needed to generate the SQLvoid
setRequiresAliases
(boolean requiresAliases) protected void
setTableAliases
(Map<DatabaseTable, DatabaseTable> theTableAliases) void
setTables
(List<DatabaseTable> theTables) void
setUnionExpressions
(List<Expression> unionExpressions) void
setUseUniqueFieldAliases
(boolean useUniqueFieldAliases) INTERNAL: If set unique field aliases will be generated of the form "fieldname AS fieldnameX" Where fieldname is the column name and X is an incremental value ensuring uniquenessboolean
INTERNAL: If a distinct has been set the DISTINCT clause will be printed.protected void
void
ADVANCED: If a distinct has been set the DISTINCT clause will be printed.protected void
writeField
(ExpressionSQLPrinter printer, DatabaseField field) INTERNAL:protected void
writeFieldsFromExpression
(ExpressionSQLPrinter printer, Expression expression, Vector<DatabaseField> newFields) INTERNAL:protected Vector
<DatabaseField> writeFieldsIn
(ExpressionSQLPrinter printer) INTERNAL:Methods inherited from class org.eclipse.persistence.internal.expressions.SQLStatement
clone, getBuilder, getExpressionBuilder, getHintString, getTranslationRow, getWhereClause, setHintString, setTranslationRow, setWhereClause, toString
-
Field Details
-
query
Query this statement is associated to (used for SQL query options). -
useUniqueFieldAliases
protected boolean useUniqueFieldAliasesFlag used to indicate field names should use unique aliases -
fieldCounter
protected int fieldCounterCounter to generate unique alias names -
fields
Fields being selected (can include expressions). -
nonSelectFields
Fields not being selected (can include expressions). -
tables
Tables being selected from. -
distinctState
protected short distinctStateUsed for "Select Distinct" option. -
orderByExpressions
Order by clause for read all queries. -
groupByExpressions
Group by clause for report queries. -
unionExpressions
Union clause. -
havingExpression
Having clause for report queries. -
forUpdateClause
Used for pessimistic locking ie. "For Update". -
isAggregateSelect
protected boolean isAggregateSelectUsed for report query or counts so we know how to treat distincts. -
outerJoinExpressionHolders
Used for DB2 style from clause outer joins. -
startWithExpression
Used for Oracle Hierarchical Queries -
connectByExpression
-
orderSiblingsByExpressions
-
direction
-
requiresAliases
protected boolean requiresAliasesVariables used for aliasing and normalizing. -
tableAliases
-
lastTable
-
currentAlias
-
currentAliasNumber
protected int currentAliasNumber -
parentStatement
Used for subselects. -
optimizedClonedExpressions
It is used by subselect to re-normalize joins -
fieldAliases
Used for caching the field alias written to the query -
shouldCacheFieldAliases
protected boolean shouldCacheFieldAliases
-
-
Constructor Details
-
SQLSelectStatement
public SQLSelectStatement()
-
-
Method Details
-
addField
-
addField
INTERNAL: adds an expression to the fields. set a flag if the expression is for and aggregate function. -
addOrderByExpressionToSelectForDistinct
protected void addOrderByExpressionToSelectForDistinct()When distinct is used with order by the ordered fields must be in the select clause. -
addTable
Add a table to the statement. The table will be used in the FROM part of the SQL statement. -
appendFromClauseForInformixOuterJoin
public void appendFromClauseForInformixOuterJoin(ExpressionSQLPrinter printer, List<DatabaseTable> outerJoinedAliases) throws IOException ADVANCED: If a platform is Informix, then the outer join must be in the FROM clause. This is used internally by EclipseLink for building Informix outer join syntax which differs from other platforms (Oracle,Sybase) that print the outer join in the WHERE clause and from DB2 which prints the OuterJoinedAliases passed in to keep track of tables used for outer join so no normal join is given. This syntax is old for Informix, so should probably be removed.- Throws:
IOException
-
appendFromClauseForOuterJoin
public void appendFromClauseForOuterJoin(ExpressionSQLPrinter printer, List<DatabaseTable> outerJoinedAliases, Collection aliasesOfTablesToBeLocked, boolean shouldPrintUpdateClauseForAllTables) throws IOException ADVANCED: Appends the SQL standard outer join clause, and some variation per platform. Most platforms use this syntax, support is also offered for Oracle to join in the where clause (although it should use the FROM clause as the WHERE clause is obsolete). This is also used for inner joins when configured in the platform.- Throws:
IOException
-
printOnClause
protected void printOnClause(Expression onClause, ExpressionSQLPrinter printer, DatabasePlatform platform) throws IOException Print the outer join ON clause. Some databases do not allow brackets.- Throws:
IOException
-
printForUpdateClauseOnJoin
protected void printForUpdateClauseOnJoin(DatabaseTable alias, ExpressionSQLPrinter printer, boolean shouldPrintUpdateClauseForAllTables, Collection aliasesOfTablesToBeLocked, DatabasePlatform platform) Print the FOR UPDATE clause after each join if required. -
appendFromClauseToWriter
Print the from clause. This includes outer joins, these must be printed before the normal join to ensure that the source tables are not joined again. Outer joins are not printed in the FROM clause on Oracle or Sybase.- Throws:
IOException
-
appendGroupByClauseToWriter
This method will append the group by clause to the end of the select statement.- Throws:
IOException
-
appendHierarchicalQueryClauseToWriter
This method will append the Hierarchical Query Clause to the end of the select statement- Throws:
IOException
-
appendOrderClauseToWriter
This method will append the order clause to the end of the select statement.- Throws:
IOException
-
appendUnionClauseToWriter
This method will append the union clause to the end of the select statement.- Throws:
IOException
-
appendForUpdateClause
This method will append the for update clause to the end of the select statement. -
assignAliases
INTERNAL: Alias the tables in all of our nodes. -
buildCall
Build the call, setting the query first, this is required in some cases when the query info is required to print the SQL. -
buildCall
Print the SQL representation of the statement on a stream.- Specified by:
buildCall
in classSQLStatement
-
computeDistinct
public void computeDistinct()INTERNAL: This is used by cursored stream to determine if an expression used distinct as the size must account for this. -
isSubSelect
public boolean isSubSelect() -
getOptimizedClonedExpressions
INTERNAL: It is used by subqueries to avoid duplicate joins. -
addOptimizedClonedExpressions
INTERNAL: It is used by subqueries to avoid duplicate joins. -
computeTables
public void computeTables()INTERNAL: Computes all aliases which will appear in the FROM clause. -
computeTablesFromTables
public void computeTablesFromTables()If there is no where clause, alias the tables from the tables list directly. Assume there's no ambiguity -
dontUseDistinct
public void dontUseDistinct()ADVANCED: If a distinct has been set the DISTINCT clause will be printed. This is used internally by TopLink for batch reading but may also be used directly for advanced queries or report queries. -
fieldsContainField
Check if the field from the field expression is already contained in the select clause of the statement. This is used on order by expression when the field being ordered by must be in the select, but cannot be in the select twice. -
getCurrentAliasNumber
public int getCurrentAliasNumber()Gets a unique id that will be used to alias the next table. For sub-selects all must use this same aliasing information, maintained in the root enclosing statement. For CR#2627019 -
getFields
INTERNAL: Return all the fields -
getForUpdateClause
-
getGroupByExpressions
INTERNAL: Return the group bys. -
getHavingExpression
INTERNAL: Return the having expression. -
getQuery
INTERNAL: Query held as it may store properties needed to generate the SQL -
getStartWithExpression
INTERNAL: Return the StartWith expression -
getConnectByExpression
INTERNAL: Return the CONNECT BY expression -
getOrderSiblingsByExpressions
INTERNAL: Return the ORDER SIBLINGS BY expression -
getDirection
INTERNAL:- Returns:
- the position of the PRIOR keyword
-
getNextFieldCounterValue
public int getNextFieldCounterValue()INTERNAL: Return the next value of fieldCounter -
getNonSelectFields
Return the fields we don't want to select but want to join on. -
getOrderByExpressions
INTERNAL: Return the order expressions for the query. -
getUnionExpressions
-
setUnionExpressions
-
getOuterJoinExpressionsHolders
INTERNAL: returns outerJoinExpressionHolders representing outerjoin expressions. -
addOuterJoinExpressionsHolders
public Integer addOuterJoinExpressionsHolders(ObjectExpression joinExpression, Expression outerJoinedMappingCriteria, Map<DatabaseTable, Expression> outerJoinedAdditionalJoinCriteria, ClassDescriptor descriptor) INTERNAL: Used by ExpressionBuilder and QueryKeyExpression normalization to create a standard outerjoin.- Parameters:
joinExpression
- - expression resulting in the outerjoin. Null if it is for inheritance reading of subclassesouterJoinedMappingCriteria
- - used for querykey mapping expressionsouterJoinedAdditionalJoinCriteria
- - additional tables/expressions to join. Usually for multitableInheritance join expressionsdescriptor
- - descriptor to use if this is for reading in subclasses in one query.
-
addOuterJoinExpressionsHolders
public Integer addOuterJoinExpressionsHolders(Map<DatabaseTable, Expression> outerJoinedAdditionalJoinCriteria, ClassDescriptor descriptor) INTERNAL: used by TREAT to add in a join from the parent table to the child tables when the parent expression did not add an outer join of its own -
getParentStatement
Return the parent statement if using subselects. This is used to normalize correctly with subselects. -
getTableAliases
INTERNAL: Return the aliases used. -
getTables
INTERNAL: Return all the tables. -
getUseUniqueFieldAliases
public boolean getUseUniqueFieldAliases()INTERNAL: Return True if unique field aliases will be generated of the form "fieldname AS fieldnameX", False otherwise. -
hasAliasForTable
-
hasGroupByExpressions
public boolean hasGroupByExpressions() -
hasHavingExpression
public boolean hasHavingExpression() -
hasStartWithExpression
public boolean hasStartWithExpression() -
hasConnectByExpression
public boolean hasConnectByExpression() -
hasOrderSiblingsByExpressions
public boolean hasOrderSiblingsByExpressions() -
hasHierarchicalQueryExpressions
public boolean hasHierarchicalQueryExpressions() -
hasOrderByExpressions
public boolean hasOrderByExpressions() -
hasUnionExpressions
public boolean hasUnionExpressions() -
hasNonSelectFields
public boolean hasNonSelectFields() -
hasOuterJoinExpressions
public boolean hasOuterJoinExpressions() -
isAggregateSelect
public boolean isAggregateSelect()INTERNAL: -
isDistinctComputed
public boolean isDistinctComputed()INTERNAL: return true if this query has computed its distinct value already -
normalize
INTERNAL: Normalize an expression into a printable structure. i.e. merge the expression with the join expressions. Also replace table names with corresponding aliases. -
normalize
INTERNAL: Normalize an expression into a printable structure. i.e. merge the expression with the join expressions. Also replace table names with corresponding aliases.- Parameters:
clonedExpressions
- With 2612185 allows additional expressions from multiple bases to be rebuilt on the correct cloned base.
-
normalizeForView
public void normalizeForView(AbstractSession theSession, ClassDescriptor theDescriptor, Map clonedExpressions) INTERNAL: Normalize an expression mapping all of the descriptor's tables to the view. This is used to allow a descriptor to read from a view, but write to tables. This is used in the multiple table and subclasses read so all of the descriptor's possible tables must be mapped to the view. -
normalizeOrderBy
protected void normalizeOrderBy(Expression builder, List<Expression> allExpressions, Map<Expression, Expression> clonedExpressions, AbstractSession session) Check the order by for object expressions. Order by the objects primary key or all fields for aggregates. -
printSQL
Print the SQL representation of the statement on a stream. -
printSQLSelect
- Throws:
IOException
-
printSQLWhereKeyWord
- Throws:
IOException
-
printSQLWhereClause
- Throws:
IOException
-
printSQLHierarchicalQueryClause
- Throws:
IOException
-
printSQLGroupByClause
- Throws:
IOException
-
printSQLHavingClause
- Throws:
IOException
-
printSQLOrderByClause
- Throws:
IOException
-
printSQLForUpdateClause
- Throws:
IOException
-
printSQLUnionClause
- Throws:
IOException
-
rebuildAndAddExpressions
public void rebuildAndAddExpressions(List expressions, List allExpressions, ExpressionBuilder primaryBuilder, Map clonedExpressions) Rebuild the expressions with the correct expression builder if using a different one. -
rebuildExpression
public Expression rebuildExpression(Expression expression, Expression primaryBuilder, Map<Expression, Expression> clonedExpressions) Rebuild the expression if required. -
rebuildAndAddExpressions
public void rebuildAndAddExpressions(Map expressions, Vector allExpressions, ExpressionBuilder primaryBuilder, Map clonedExpressions) Rebuild the expressions with the correct expression builder if using a different one. Exact copy of the another rebuildAndAddExpressions adopted to a Map with Expression values as the first parameter (instead of Vector in the original method) -
removeField
INTERNAL: -
removeTable
Remove a table from the statement. The table will be dropped from the FROM part of the SQL statement. -
requiresAliases
public boolean requiresAliases()INTERNAL: Returns true if aliases are required, false otherwise. If requiresAliases is set then force aliasing, this is required for object-rel. -
resetDistinct
public void resetDistinct()ADVANCED: If a distinct has been set the DISTINCT clause will be printed. This is used internally by TopLink for batch reading but may also be used directly for advanced queries or report queries. -
setBuilder
- Overrides:
setBuilder
in classSQLStatement
-
setCurrentAliasNumber
public void setCurrentAliasNumber(int currentAliasNumber) Sets a unique id that will be used to alias the next table. For sub-selects all must use this same aliasing information, maintained in the root enclosing statement. For CR#2627019 -
setNonSelectFields
Set the non select fields. The fields are used only on joining. -
setNormalizedWhereClause
Set the where clause expression. This must be used during normalization as the normal setWhereClause has the side effect of setting the builder, which must not occur during normalize. -
setDistinctState
public void setDistinctState(short distinctState) ADVANCED: If a distinct has been set the DISTINCT clause will be printed. This is used internally by TopLink for batch reading but may also be used directly for advanced queries or report queries. -
setFields
INTERNAL: Set the fields, if any are aggregate selects then record this so that the distinct is not printed through anyOfs. -
setGroupByExpressions
-
setHavingExpression
-
setHierarchicalQueryExpressions
public void setHierarchicalQueryExpressions(Expression startWith, Expression connectBy, List<Expression> orderSiblingsExpressions) INTERNAL: takes the hierarchical query expression which have been set on the query and sets them here used to generate the Hierarchical Query Clause in the SQL -
setHierarchicalQueryExpressions
public void setHierarchicalQueryExpressions(Expression startWith, Expression connectBy, List<Expression> orderSiblingsExpressions, ReadAllQuery.Direction direction) INTERNAL: takes the hierarchical query expression which have been set on the query and sets them here used to generate the Hierarchical Query Clause in the SQL -
setIsAggregateSelect
public void setIsAggregateSelect(boolean isAggregateSelect) -
setForUpdateClause
-
setLockingClause
-
setOrderByExpressions
-
setParentStatement
Set the parent statement if using subselects. This is used to normalize correctly with subselects. -
setQuery
Query held as it may store properties needed to generate the SQL -
setRequiresAliases
public void setRequiresAliases(boolean requiresAliases) -
setTableAliases
-
setTables
-
setUseUniqueFieldAliases
public void setUseUniqueFieldAliases(boolean useUniqueFieldAliases) INTERNAL: If set unique field aliases will be generated of the form "fieldname AS fieldnameX" Where fieldname is the column name and X is an incremental value ensuring uniqueness -
shouldDistinctBeUsed
public boolean shouldDistinctBeUsed()INTERNAL: If a distinct has been set the DISTINCT clause will be printed. This is required for batch reading. -
useDistinct
public void useDistinct()ADVANCED: If a distinct has been set the DISTINCT clause will be printed. This is used internally by TopLink for batch reading but may also be used directly for advanced queries or report queries. -
writeField
INTERNAL: -
enableFieldAliasesCaching
public void enableFieldAliasesCaching() -
getAliasFor
-
generatedAlias
Returns a generated alias based on the column name. If the new alias will be too long The alias is automatically truncated -
writeFieldsFromExpression
protected void writeFieldsFromExpression(ExpressionSQLPrinter printer, Expression expression, Vector<DatabaseField> newFields) INTERNAL: -
writeFieldsIn
INTERNAL: -
mapTableIndexToExpression
public static SortedSet mapTableIndexToExpression(Expression expression, TreeMap map, List<DatabaseTable> tablesInOrder) INTERNAL: The method searches for expressions that join two tables each in a given expression. Given expression and tablesInOrder and an empty SortedMap (TreeMap with no Comparator), this method populates the map with expressions corresponding to two tables keyed by an index (in tablesInOrder) of the table with the highest (of two) index; returns all the participating in at least one of the expressions. Example: expression (joining Employee to Project through m-m mapping "projects"): (employee.emp_id = proj_emp.emp_id) and (proj_emp.proj_id = project.proj_id) tablesInOrder: employee, proj_emp, project results: map: 1 -> (employee.emp_id = proj_emp.emp_id) 2 -> (proj_emp.proj_id = project.proj_id) returned SortedSet: {0, 1, 2}. Note that tablesInOrder must contain all tables used by expression -
mapTableToExpression
INTERNAL: The method searches for expressions that join two tables each in a given expression. Given expression and tablesInOrder, this method returns the map with expressions corresponding to two tables keyed by tables (from tablesInOrder) with the highest (of two) index; Example: expression (joining Employee to Project through m-m mapping "projects"): (employee.emp_id = proj_emp.emp_id) and (proj_emp.proj_id = project.proj_id) tablesInOrder: employee, proj_emp, project results: returned map: proj_emp -> (employee.emp_id = proj_emp.emp_id) project -> (proj_emp.proj_id = project.proj_id) Note that tablesInOrder must contain all tables used by expression -
sortOuterJoinExpressionHolders
-