Class RelationExpression

    • Field Detail

      • isObjectComparisonExpression

        protected Boolean isObjectComparisonExpression
        PERF: Cache if the expression is an object comparison expression.
    • Constructor Detail

      • RelationExpression

        public RelationExpression()
    • 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:
        convertNodeToUseOuterJoin in class Expression
      • 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:
        doesConform in class Expression
        isObjectUnregistered - 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:
        extractValues in class Expression
        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:
        extractFields in class Expression
      • 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.
      • 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.
      • 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.
      • 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:
        validateNode in class CompoundExpression