Top Description Fields Constructors Methods
org.eclipse.persistence.internal.expressions

public Class RelationExpression

extends CompoundExpression
Class Inheritance
Imports
java.util.ArrayList, .Collection, .Enumeration, .List, .Map, .Set, .Vector, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.exceptions.QueryException, org.eclipse.persistence.expressions.Expression, .ExpressionBuilder, .ExpressionOperator, org.eclipse.persistence.internal.helper.DatabaseField, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, org.eclipse.persistence.mappings.DatabaseMapping, .OneToOneMapping, org.eclipse.persistence.queries.ReportQuery

Purpose:Used for all relation operators except for between.

Field Summary

Modifier and TypeField and Description
protected Boolean
isObjectComparisonExpression

PERF: Cache if the expression is an object comparison expression.

Inherited from org.eclipse.persistence.internal.expressions.CompoundExpression:
builderfirstChildoperatorplatformOperatorsecondChild

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected boolean
allChildrenAreFields()

Test that both of our children are field nodes

protected Expression

Returns:

null if cannot be optimized, otherwise the optimized normalized expression.
checkForeignKeyJoinOptimization
(Expression first, Expression second, ExpressionNormalizer normalizer)

PERF: Optimize out unnecessary joins.

protected void
convertNodeToUseOuterJoin()

Overrides org.eclipse.persistence.expressions.Expression.convertNodeToUseOuterJoin.

INTERNAL: Modify this individual expression node to use outer joins wherever there are equality operations between two field nodes.
public String
protected boolean
doesAnyOfLeftValuesConform(Vector<E> leftValues, Object rightValue, AbstractSession session)

Conform in-memory the collection of left values with the right value for this expression.

public boolean
doesConform(Object object, AbstractSession session, AbstractRecord translationRow, int valueHolderPolicy, boolean
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.
isObjectUnregistered
)

Overrides org.eclipse.persistence.expressions.Expression.doesConform.

INTERNAL: Check if the object conforms to the expression in memory.
public boolean
doesObjectConform(Object leftValue, Object rightValue, AbstractSession session)

INTERNAL: Check if the object conforms to the expression in memory.

protected boolean
doValuesConform(Object leftValue, Object rightValue, AbstractSession session)

Conform in-memory the two values.

public boolean
extractFields(boolean requireExactMatch, boolean primaryKey, ClassDescriptor descriptor, List<DatabaseField> searchFields, Set<DatabaseField> foundFields)

Overrides org.eclipse.persistence.expressions.Expression.extractFields.

INTERNAL: Return if the expression is not a valid primary key expression and add all primary key fields to the set.
public boolean
extractValues(boolean primaryKeyOnly, boolean
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.
requireExactMatch
,
ClassDescriptor descriptor, AbstractRecord primaryKeyRow, AbstractRecord translationRow)

Overrides org.eclipse.persistence.expressions.Expression.extractValues.

INTERNAL: Extract the values from the expression into the row.
public boolean
isEqualNull(ExpressionSQLPrinter printer)

Check if the expression is an equal null expression, these must be handle in a special way in SQL.

public boolean
isNotEqualNull(ExpressionSQLPrinter printer)

Check if the expression is an equal null expression, these must be handle in a special way in SQL.

protected boolean
isObjectComparison(AbstractSession session)

INTERNAL: Return if the represents an object comparison.

public boolean
public Expression
normalize(ExpressionNormalizer normalizer)

Overrides org.eclipse.persistence.internal.expressions.CompoundExpression.normalize.

INTERNAL: Check for object comparison as this requires for the expression to be replaced by the object comparison.
public boolean
performSelector(boolean areValuesEqual)

INTERNAL: Check if the object conforms to the expression in memory.

public void
printJava(ExpressionJavaPrinter printer)

Overrides org.eclipse.persistence.internal.expressions.CompoundExpression.printJava.

INTERNAL: Print java for project class generation
public void
public void
printSQLNoParens(ExpressionSQLPrinter printer)

INTERNAL: Print SQL without adding parentheses (for DB2 outer joins).

public void
Inherited from org.eclipse.persistence.internal.expressions.CompoundExpression:
aliasForTableasOfcomputeHashCodecreatecreateequalsgetBuildergetFirstChildgetOperatorgetPlatformOperatorgetSecondChildinitializePlatformOperatorisCompoundExpressioniterateOnpostCopyInrebuildOnresetPlaceHolderBuildersetFirstChildsetOperatorsetSecondChildshallowClonetwistedForBaseAndContextwriteDescriptionOnwriteSubexpressionsTo

Field Detail

isObjectComparisonExpressionback to summary
protected Boolean isObjectComparisonExpression

PERF: Cache if the expression is an object comparison expression.

Constructor Detail

RelationExpressionback to summary
public RelationExpression()

Method Detail

allChildrenAreFieldsback to summary
protected boolean allChildrenAreFields()

Test that both of our children are field nodes

checkForeignKeyJoinOptimizationback to summary
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:Expression

null if cannot be optimized, otherwise the optimized normalized expression.

convertNodeToUseOuterJoinback to summary
protected void convertNodeToUseOuterJoin()

Overrides org.eclipse.persistence.expressions.Expression.convertNodeToUseOuterJoin.

INTERNAL: Modify this individual expression node to use outer joins wherever there are equality operations between two field nodes.

Annotations
@Override
descriptionOfNodeTypeback to summary
public String descriptionOfNodeType()

Overrides org.eclipse.persistence.internal.expressions.CompoundExpression.descriptionOfNodeType.

INTERNAL: Used for debug printing.

Annotations
@Override
doesAnyOfLeftValuesConformback to summary
protected boolean doesAnyOfLeftValuesConform(Vector<E> 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.

doesConformback to summary
public boolean doesConform(Object object, AbstractSession session, AbstractRecord translationRow, int valueHolderPolicy, boolean isObjectUnregistered)

Overrides org.eclipse.persistence.expressions.Expression.doesConform.

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.

Parameters
isObjectUnregistered:boolean

Doc from org.eclipse.persistence.expressions.Expression.doesConform.

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.

Annotations
@Override
doesObjectConformback to summary
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.

doValuesConformback to summary
protected boolean doValuesConform(Object leftValue, Object rightValue, AbstractSession session)

Conform in-memory the two values.

extractFieldsback to summary
public boolean extractFields(boolean requireExactMatch, boolean primaryKey, ClassDescriptor descriptor, List<DatabaseField> searchFields, Set<DatabaseField> foundFields)

Overrides org.eclipse.persistence.expressions.Expression.extractFields.

INTERNAL: Return if the expression is not a valid primary key expression and add all primary key fields to the set.

Annotations
@Override
extractValuesback to summary
public boolean extractValues(boolean primaryKeyOnly, boolean requireExactMatch, ClassDescriptor descriptor, AbstractRecord primaryKeyRow, AbstractRecord translationRow)

Overrides org.eclipse.persistence.expressions.Expression.extractValues.

INTERNAL: Extract the values from the expression into the row. Ensure that the query is querying the exact primary key.

Parameters
requireExactMatch:boolean

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.

Annotations
@Override
isEqualNullback to summary
public boolean isEqualNull(ExpressionSQLPrinter printer)

Check if the expression is an equal null expression, these must be handle in a special way in SQL.

isNotEqualNullback to summary
public boolean isNotEqualNull(ExpressionSQLPrinter printer)

Check if the expression is an equal null expression, these must be handle in a special way in SQL.

isObjectComparisonback to summary
protected boolean isObjectComparison(AbstractSession session)

INTERNAL: Return if the represents an object comparison.

isRelationExpressionback to summary
public boolean isRelationExpression()

Overrides org.eclipse.persistence.expressions.Expression.isRelationExpression.

INTERNAL:

Annotations
@Override
normalizeback to summary
public Expression normalize(ExpressionNormalizer normalizer)

Overrides org.eclipse.persistence.internal.expressions.CompoundExpression.normalize.

INTERNAL: Check for object comparison as this requires for the expression to be replaced by the object comparison.

Annotations
@Override
performSelectorback to summary
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.

printJavaback to summary
public void printJava(ExpressionJavaPrinter printer)

Overrides org.eclipse.persistence.internal.expressions.CompoundExpression.printJava.

INTERNAL: Print java for project class generation

Annotations
@Override
printSQLback to summary
public void printSQL(ExpressionSQLPrinter printer)

Overrides org.eclipse.persistence.internal.expressions.CompoundExpression.printSQL.

INTERNAL: Print SQL

Annotations
@Override
printSQLNoParensback to summary
public void printSQLNoParens(ExpressionSQLPrinter printer)

INTERNAL: Print SQL without adding parentheses (for DB2 outer joins).

validateNodeback to summary
public void validateNode()

Overrides org.eclipse.persistence.internal.expressions.CompoundExpression.validateNode.

Do any required validation for this node. Throw an exception if it's incorrect.

Annotations
@Override