Class ComparisonExpressionStateObject

All Implemented Interfaces:
StateObject

public class ComparisonExpressionStateObject extends CompoundExpressionStateObject
Only the values of like types are permitted to be compared. A type is like another type if they correspond to the same Java language type, or if one is a primitive Java language type and the other is the wrapped Java class type equivalent (e.g., int and Integer are like types in this sense).

There is one exception to this rule: it is valid to compare numeric values for which the rules of numeric promotion apply. Conditional expressions attempting to compare non-like type values are disallowed except for this numeric case.

Note that the arithmetic operators and comparison operators are permitted to be applied to state-fields and input parameters of the wrapped Java class equivalents to the primitive numeric Java types. Two entities of the same abstract schema type are equal if and only if they have the same primary key value. Only equality/inequality comparisons over enumeration constants are required to be supported.

JPA 1.0 - BNF:

comparison_expression ::= string_expression comparison_operator {string_expression | all_or_any_expression} |
                          boolean_expression {=|<>} {boolean_expression | all_or_any_expression} |
                          enum_expression {=|<>} {enum_expression | all_or_any_expression} |
                          datetime_expression comparison_operator {datetime_expression | all_or_any_expression} |
                          entity_expression {=|<>} {entity_expression | all_or_any_expression} |
                          arithmetic_expression comparison_operator {arithmetic_expression | all_or_any_expression}
JPA 2.0 - BNF:
comparison_expression ::= string_expression comparison_operator {string_expression | all_or_any_expression} |
                          boolean_expression {=|<>} {boolean_expression | all_or_any_expression} |
                          enum_expression {=|<>} {enum_expression | all_or_any_expression} |
                          datetime_expression comparison_operator {datetime_expression | all_or_any_expression} |
                          entity_expression {=|<>} {entity_expression | all_or_any_expression} |
                          arithmetic_expression comparison_operator {arithmetic_expression | all_or_any_expression} |
                          entity_type_expression {=|<>} entity_type_expression}
Since:
2.4
Version:
2.4
See Also:
  • Field Details

    • IDENTIFIER_PROPERTY

      public static final String IDENTIFIER_PROPERTY
      Notifies the identifier property has changed.
      See Also:
  • Constructor Details

    • ComparisonExpressionStateObject

      public ComparisonExpressionStateObject(StateObject parent, StateObject leftStateObject, String identifier, StateObject rightStateObject)
      Creates a new ComparisonExpressionStateObject.
      Parameters:
      parent - The parent of this state object, which cannot be null
      leftStateObject - The StateObject representing the left expression
      identifier - The comparison identifier, either <, <=, =, >=, <>
      rightStateObject - The StateObject representing the right expression
      Throws:
      NullPointerException - The given parent cannot be null
    • ComparisonExpressionStateObject

      public ComparisonExpressionStateObject(StateObject parent, String identifier)
      Creates a new ComparisonExpressionStateObject.
      Parameters:
      parent - The parent of this state object, which cannot be null
      identifier - The comparison identifier, either <, <=, =, >=, <>
      Throws:
      NullPointerException - The given parent cannot be null
    • ComparisonExpressionStateObject

      public ComparisonExpressionStateObject(StateObject parent, String leftJpqlFragment, String identifier, String rightJpqlFragment)
      Creates a new ComparisonExpressionStateObject.
      Parameters:
      parent - The parent of this state object, which cannot be null
      leftJpqlFragment - The string representation of the left expression to parse and to convert into a StateObject
      identifier - The comparison identifier, either <, <=, =, >=, <>
      rightJpqlFragment - The string representation of the right expression to parse and to convert into a StateObject
      Throws:
      NullPointerException - The given parent cannot be null
  • Method Details