Module org.eclipse.persistence.core
Class RelationExpression
- java.lang.Object
-
- org.eclipse.persistence.expressions.Expression
-
- org.eclipse.persistence.internal.expressions.CompoundExpression
-
- org.eclipse.persistence.internal.expressions.RelationExpression
-
- All Implemented Interfaces:
Serializable,Cloneable
public class RelationExpression extends CompoundExpression
Purpose:Used for all relation operators except for between.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BooleanisObjectComparisonExpressionPERF: Cache if the expression is an object comparison expression.-
Fields inherited from class org.eclipse.persistence.internal.expressions.CompoundExpression
builder, firstChild, operator, platformOperator, secondChild
-
Fields inherited from class org.eclipse.persistence.expressions.Expression
currentAlias, hashCode, lastTable, selectIfOrderedBy, shouldUseUpperCaseForIgnoreCase
-
-
Constructor Summary
Constructors Constructor Description RelationExpression()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanallChildrenAreFields()Test that both of our children are field nodesprotected ExpressioncheckForeignKeyJoinOptimization(Expression first, Expression second, ExpressionNormalizer normalizer)PERF: Optimize out unnecessary joins.protected voidconvertNodeToUseOuterJoin()INTERNAL: Modify this individual expression node to use outer joins wherever there are equality operations between two field nodes.StringdescriptionOfNodeType()INTERNAL: Used for debug printing.protected booleandoesAnyOfLeftValuesConform(Vector leftValues, Object rightValue, AbstractSession session)Conform in-memory the collection of left values with the right value for this expression.booleandoesConform(Object object, AbstractSession session, AbstractRecord translationRow, int valueHolderPolicy, boolean isObjectUnregistered)INTERNAL: Check if the object conforms to the expression in memory.booleandoesObjectConform(Object leftValue, Object rightValue, AbstractSession session)INTERNAL: Check if the object conforms to the expression in memory.protected booleandoValuesConform(Object leftValue, Object rightValue, AbstractSession session)Conform in-memory the two values.booleanextractFields(boolean requireExactMatch, boolean primaryKey, ClassDescriptor descriptor, List<DatabaseField> searchFields, Set<DatabaseField> foundFields)INTERNAL: Return if the expression is not a valid primary key expression and add all primary key fields to the set.booleanextractValues(boolean primaryKeyOnly, boolean requireExactMatch, ClassDescriptor descriptor, AbstractRecord primaryKeyRow, AbstractRecord translationRow)INTERNAL: Extract the values from the expression into the row.booleanisEqualNull(ExpressionSQLPrinter printer)Check if the expression is an equal null expression, these must be handle in a special way in SQL.booleanisNotEqualNull(ExpressionSQLPrinter printer)Check if the expression is an equal null expression, these must be handle in a special way in SQL.protected booleanisObjectComparison(AbstractSession session)INTERNAL: Return if the represents an object comparison.booleanisRelationExpression()INTERNAL:Expressionnormalize(ExpressionNormalizer normalizer)INTERNAL: Check for object comparison as this requires for the expression to be replaced by the object comparison.booleanperformSelector(boolean areValuesEqual)INTERNAL: Check if the object conforms to the expression in memory.voidprintJava(ExpressionJavaPrinter printer)INTERNAL: Print java for project class generationvoidprintSQL(ExpressionSQLPrinter printer)INTERNAL: Print SQLvoidprintSQLNoParens(ExpressionSQLPrinter printer)INTERNAL: Print SQL without adding parentheses (for DB2 outer joins).voidvalidateNode()Do any required validation for this node.-
Methods inherited from class org.eclipse.persistence.internal.expressions.CompoundExpression
aliasForTable, asOf, computeHashCode, create, create, equals, getBuilder, getFirstChild, getOperator, getPlatformOperator, getSecondChild, initializePlatformOperator, isCompoundExpression, iterateOn, postCopyIn, rebuildOn, resetPlaceHolderBuilder, setFirstChild, setOperator, setSecondChild, shallowClone, twistedForBaseAndContext, writeDescriptionOn, writeSubexpressionsTo
-
Methods inherited from class org.eclipse.persistence.expressions.Expression
addDate, addDate, addMonths, addMonths, alias, all, all, all, all, all, all, all, all, all, all, all, all, allOf, and, any, any, any, any, any, any, any, any, any, any, any, any, anyOf, anyOf, anyOfAllowingNone, anyOfAllowingNone, as, ascending, asciiValue, assignAlias, assignTableAliasesStartingAt, average, between, between, between, between, between, between, between, between, between, caseConditionStatement, caseConditionStatement, caseStatement, caseStatement, cast, clone, cloneUsing, coalesce, coalesce, concat, containsAllKeyWords, containsAnyKeyWords, containsSubstring, containsSubstring, containsSubstringIgnoringCase, containsSubstringIgnoringCase, convertToUseOuterJoin, copiedVersionFrom, count, createWithBaseLast, currentDate, currentDateDate, currentTime, currentTimeStamp, dateDifference, dateDifference, dateName, datePart, dateToString, decode, descending, difference, distinct, doesConform, equal, equal, equal, equal, equal, equal, equal, equal, equal, equal, equalOuterJoin, equalOuterJoin, equalsIgnoreCase, equalsIgnoreCase, except, except, exceptAll, exceptAll, exists, existsNode, extract, extractPrimaryKeyValues, extractValue, extractXml, from, fromConstant, fromLiteral, get, get, getAlias, getAllowingNull, getAsOfClause, getAsOfClauseRecursively, getClonedField, getField, getField, getFields, getFieldValue, getFunction, getFunction, getFunction, getFunction, getFunctionWithArguments, getLeafDescriptor, getLeafMapping, getName, getNumberVal, getOperator, getOwnedTables, getParameter, getParameter, getParameter, getProperty, getSelectionFields, getSelectionFields, getSession, getStringVal, getTable, getTable, getTableAliases, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, hasAsOfClause, hasBeenAliased, hashCode, hexToRaw, ifNull, in, in, in, in, in, in, in, in, in, in, in, in, index, indexOf, intersect, intersect, intersectAll, intersectAll, isClassTypeExpression, isConstantExpression, isDataExpression, isEmpty, isExpressionBuilder, isFieldExpression, isFragment, isFunctionExpression, isLiteralExpression, isLogicalExpression, isMapEntryExpression, isNull, isObjectExpression, isParameterExpression, isQueryKeyExpression, isSubSelectExpression, isTableExpression, isTreatExpression, isValueExpression, join, lastDay, leftJoin, leftPad, leftPad, leftTrim, leftTrim, length, lessThan, lessThan, lessThan, lessThan, lessThan, lessThan, lessThan, lessThan, lessThan, lessThan, lessThanEqual, lessThanEqual, lessThanEqual, lessThanEqual, lessThanEqual, lessThanEqual, lessThanEqual, lessThanEqual, lessThanEqual, lessThanEqual, like, like, like, like, likeIgnoreCase, likeIgnoreCase, literal, localDate, localDateTime, localTime, locate, locate, locate, mapEntry, mapKey, maximum, minimum, monthsBetween, newTime, nextDay, noneOf, not, notBetween, notBetween, notBetween, notBetween, notBetween, notBetween, notBetween, notBetween, notBetween, notEmpty, notEqual, notEqual, notEqual, notEqual, notEqual, notEqual, notEqual, notEqual, notEqual, notEqual, notExists, notIn, notIn, notIn, notIn, notIn, notIn, notIn, notIn, notIn, notIn, notIn, notIn, notLike, notLike, notLike, notLike, notNull, nullIf, nullsFirst, nullsLast, operator, or, performOperator, postfixSQL, prefixSQL, ref, regexp, regexp, registerIn, replace, replicate, replicate, resetCache, reverse, right, right, rightPad, rightPad, rightTrim, rightTrim, roundDate, selectIfOrderedBy, setLocalBase, setSelectIfOrderedBy, size, size, some, some, some, some, some, some, some, some, some, some, some, some, sql, standardDeviation, subQuery, substring, substring, substring, substring, sum, toChar, toChar, toCharacter, toDate, toLowerCase, toNumber, toString, toString, toUpperCase, toUppercaseCasedWords, translate, treat, trim, trim, truncateDate, twist, type, union, union, unionAll, unionAll, value, value, value, value, value, value, value, value, value, value, valueFromObject, valueFromObject, variance, writeAlias, writeField, writeFields
-
-
-
-
Field Detail
-
isObjectComparisonExpression
protected Boolean isObjectComparisonExpression
PERF: Cache if the expression is an object comparison expression.
-
-
Method Detail
-
allChildrenAreFields
protected boolean allChildrenAreFields()
Test that both of our children are field nodes
-
convertNodeToUseOuterJoin
protected void convertNodeToUseOuterJoin()
INTERNAL: Modify this individual expression node to use outer joins wherever there are equality operations between two field nodes.- Overrides:
convertNodeToUseOuterJoinin classExpression
-
descriptionOfNodeType
public String descriptionOfNodeType()
INTERNAL: Used for debug printing.- Overrides:
descriptionOfNodeTypein classCompoundExpression
-
doesConform
public boolean doesConform(Object object, AbstractSession session, AbstractRecord translationRow, int valueHolderPolicy, boolean isObjectUnregistered)
INTERNAL: Check if the object conforms to the expression in memory. This is used for in-memory querying. If the expression in not able to determine if the object conform throw a not supported exception.- Overrides:
doesConformin classExpressionisObjectUnregistered- true if object possibly not a clone, but is being conformed against the unit of work cache; if object is not in the UOW cache but some of its attributes are, use the registered versions of object's attributes for the purposes of this method.
-
doesAnyOfLeftValuesConform
protected boolean doesAnyOfLeftValuesConform(Vector leftValues, Object rightValue, AbstractSession session)
Conform in-memory the collection of left values with the right value for this expression. This is used for anyOf support when the left side is a collection of values.
-
doValuesConform
protected boolean doValuesConform(Object leftValue, Object rightValue, AbstractSession session)
Conform in-memory the two values.
-
doesObjectConform
public boolean doesObjectConform(Object leftValue, Object rightValue, AbstractSession session)
INTERNAL: Check if the object conforms to the expression in memory. This is used for in-memory querying across object relationships.
-
extractValues
public boolean extractValues(boolean primaryKeyOnly, boolean requireExactMatch, ClassDescriptor descriptor, AbstractRecord primaryKeyRow, AbstractRecord translationRow)INTERNAL: Extract the values from the expression into the row. Ensure that the query is querying the exact primary key.- Overrides:
extractValuesin classExpression- Parameters:
requireExactMatch- refers to the primary key extracted gaurenteeing the result, if not exact it is a heuristic and the cache hit will be conformed to the expression after the lookup Return false if not on the primary key.
-
extractFields
public boolean extractFields(boolean requireExactMatch, boolean primaryKey, ClassDescriptor descriptor, List<DatabaseField> searchFields, Set<DatabaseField> foundFields)INTERNAL: Return if the expression is not a valid primary key expression and add all primary key fields to the set.- Overrides:
extractFieldsin classExpression
-
isEqualNull
public boolean isEqualNull(ExpressionSQLPrinter printer)
Check if the expression is an equal null expression, these must be handle in a special way in SQL.
-
isNotEqualNull
public boolean isNotEqualNull(ExpressionSQLPrinter printer)
Check if the expression is an equal null expression, these must be handle in a special way in SQL.
-
isObjectComparison
protected boolean isObjectComparison(AbstractSession session)
INTERNAL: Return if the represents an object comparison.
-
isRelationExpression
public boolean isRelationExpression()
INTERNAL:- Overrides:
isRelationExpressionin classExpression
-
checkForeignKeyJoinOptimization
protected Expression checkForeignKeyJoinOptimization(Expression first, Expression second, ExpressionNormalizer normalizer)
PERF: Optimize out unnecessary joins. Check for relation based on foreign keys, i.e. emp.address.id = :id, and avoid join.- Returns:
- null if cannot be optimized, otherwise the optimized normalized expression.
-
normalize
public Expression normalize(ExpressionNormalizer normalizer)
INTERNAL: Check for object comparison as this requires for the expression to be replaced by the object comparison.- Overrides:
normalizein classCompoundExpression
-
performSelector
public boolean performSelector(boolean areValuesEqual)
INTERNAL: Check if the object conforms to the expression in memory. This is used for in-memory querying across object relationships.
-
printSQL
public void printSQL(ExpressionSQLPrinter printer)
INTERNAL: Print SQL- Overrides:
printSQLin classCompoundExpression
-
printJava
public void printJava(ExpressionJavaPrinter printer)
INTERNAL: Print java for project class generation- Overrides:
printJavain classCompoundExpression
-
printSQLNoParens
public void printSQLNoParens(ExpressionSQLPrinter printer)
INTERNAL: Print SQL without adding parentheses (for DB2 outer joins).
-
validateNode
public void validateNode()
Do any required validation for this node. Throw an exception if it's incorrect.- Overrides:
validateNodein classCompoundExpression
-
-