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}
| Access | Constructor and Description |
|---|---|
| public | ComparisonExpression(AbstractExpression
The parent of this expression parent, String The comparator identifier identifier)Creates a new |
| Modifier and Type | Method and Description |
|---|---|
| public void | accept(ExpressionVisitor
The visitor)ExpressionVisitor to visit this objectImplements org. Expression by the given visitor.
|
| public String | Returns: The operator comparing the two expressionsReturns the comparison operator, which is either '=', '>', '>=', '<', '<=' or '<>'. |
| public String | getLeftExpressionQueryBNFId()
Implements abstract org. JPQLQueryBNF for the left expression.
|
| public JPQLQueryBNF | getQueryBNF()
Implements org. Expression.
|
| public String | getRightExpressionQueryBNFId()
Implements abstract org. JPQLQueryBNF for the right expression.
|
| protected boolean | isParsingComplete(WordParser
The text to parse based on the current position of the cursor wordParser, String The word that was retrieved from the given text, which is the first word in the text word, Expression The expression)Expression that has already been parsedOverrides org. |
| protected String | parseIdentifier(WordParser
The wordParser)WordParser containing the text to parse, which starts with the identifierImplements abstract org. |
| ComparisonExpression | back to summary |
|---|---|
| public ComparisonExpression(AbstractExpression parent, String identifier) Creates a new
| |
| accept | back to summary |
|---|---|
| public void accept(ExpressionVisitor visitor) Implements org. Doc from org. Visits this
| |
| getComparisonOperator | back to summary |
|---|---|
| public String getComparisonOperator() Returns the comparison operator, which is either '=', '>', '>=', '<', '<=' or '<>'.
| |
| getLeftExpressionQueryBNFId | back to summary |
|---|---|
| public String getLeftExpressionQueryBNFId() Implements abstract org. Doc from org. Returns the unique identifier of the | |
| getQueryBNF | back to summary |
|---|---|
| public JPQLQueryBNF getQueryBNF() Implements org. Doc from org. Returns the BNF of this
| |
| getRightExpressionQueryBNFId | back to summary |
|---|---|
| public String getRightExpressionQueryBNFId() Implements abstract org. Doc from org. Returns the unique identifier of the | |
| isParsingComplete | back to summary |
|---|---|
| protected boolean isParsingComplete(WordParser wordParser, String word, Expression expression) Overrides org. Doc from org. Determines whether the parsing is complete based on what is left in the given text. The text is never empty.
| |
| parseIdentifier | back to summary |
|---|---|
| protected String parseIdentifier(WordParser wordParser) Implements abstract org. Doc from org. Parses the identifier of this expression.
| |