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}
ComparisonExpression
| Modifier and Type | Field and Description |
|---|---|
| private String | identifier
The comparison identifier, which is either <, <=, =, >=, <>. |
| public static final String | IDENTIFIER_PROPERTY
Notifies the identifier property has changed. |
| Access | Constructor and Description |
|---|---|
| public | ComparisonExpressionStateObject(StateObject
The parent of this state object, which cannot be parent, StateObject nullThe leftStateObject, String StateObject representing the left expressionThe comparison identifier, either <, <=, =, >=, <> identifier, StateObject The rightStateObject)StateObject representing the right expressionCreates a new |
| public | ComparisonExpressionStateObject(StateObject
The parent of this state object, which cannot be parent, String nullThe comparison identifier, either <, <=, =, >=, <> identifier)Creates a new |
| public | ComparisonExpressionStateObject(StateObject
The parent of this state object, which cannot be parent, String nullThe string representation of the left expression to parse and to
convert into a leftJpqlFragment, String StateObjectThe comparison identifier, either <, <=, =, >=, <> identifier, String The string representation of the right expression to parse and to
convert into a rightJpqlFragment)StateObjectCreates a new |
| Modifier and Type | Method and Description |
|---|---|
| public void | accept(StateObjectVisitor
The visitor)visitor to visit this objectImplements org. StateObject by the given visitor.
|
| public ComparisonExpression | getExpression()
Overrides org. Implements org. StateObject representation of the JPQL query
was created by parsing an existing JPQL query.
|
| public String | getIdentifier()
Implements abstract org. StateObjects.
|
| protected String | getLeftQueryBNFId()
Implements abstract org. |
| protected String | getRightQueryBNFId()
Implements abstract org. |
| public boolean | isEquivalent(StateObject
The stateObject)StateObject to compare its content to this oneOverrides org. Implements org. StateObject is equivalent to this one, i.e. the
information of both StateObject is the same.
|
| public void | setExpression(ComparisonExpression
The expression)parsed object representing a comparison
expressionKeeps a reference of the |
| public void | setIdentifier(String
The new comparison identifier, either <, <=, =, >=, <> identifier)Sets the comparison identifier to one of the following: <, <=, =, >=, <>. |
| protected void |
| identifier | back to summary |
|---|---|
| private String identifier The comparison identifier, which is either <, <=, =, >=, <>. | |
| IDENTIFIER_PROPERTY | back to summary |
|---|---|
| public static final String IDENTIFIER_PROPERTY Notifies the identifier property has changed. | |
| ComparisonExpressionStateObject | back to summary |
|---|---|
| public ComparisonExpressionStateObject(StateObject parent, StateObject leftStateObject, String identifier, StateObject rightStateObject) Creates a new
| |
| ComparisonExpressionStateObject | back to summary |
|---|---|
| public ComparisonExpressionStateObject(StateObject parent, String identifier) Creates a new
| |
| ComparisonExpressionStateObject | back to summary |
|---|---|
| public ComparisonExpressionStateObject(StateObject parent, String leftJpqlFragment, String identifier, String rightJpqlFragment) Creates a new
| |
| accept | back to summary |
|---|---|
| public void accept(StateObjectVisitor visitor) Implements org. Doc from org. Visits this
| |
| getExpression | back to summary |
|---|---|
| public ComparisonExpression getExpression() Overrides org. Implements org. Doc from org. Returns the actual parsed object if this
| |
| getIdentifier | back to summary |
|---|---|
| public String getIdentifier() Implements abstract org. Doc from org. Returns the identifier joining the two | |
| getLeftQueryBNFId | back to summary |
|---|---|
| protected String getLeftQueryBNFId() Implements abstract org. Doc from org. Returns the unique identifier of the BNF that will be used to parse a JPQL fragment as the left side of the expression. | |
| getRightQueryBNFId | back to summary |
|---|---|
| protected String getRightQueryBNFId() Implements abstract org. Doc from org. Returns the unique identifier of the BNF that will be used to parse a JPQL fragment as the right side of the expression. | |
| isEquivalent | back to summary |
|---|---|
| public boolean isEquivalent(StateObject stateObject) Overrides org. Implements org. Doc from org. Determines whether the given
| |
| setExpression | back to summary |
|---|---|
| public void setExpression(ComparisonExpression expression) Keeps a reference of the
| |
| setIdentifier | back to summary |
|---|---|
| public void setIdentifier(String identifier) Sets the comparison identifier to one of the following: <, <=, =, >=, <>.
| |
| validateIdentifier | back to summary |
|---|---|
| protected void validateIdentifier(String identifier) | |