Документация по Обновления HQL гласит:
BNF для операторов UPDATE одинаков в HQL и JPQL:
update_statement ::=
update_clause [where_clause]
update_clause ::=
UPDATE entity_name [[AS] identification_variable]
SET update_item {, update_item}*
update_item ::=
[identification_variable.]{state_field | single_valued_object_field} = new_value
new_value ::=
scalar_expression | simple_entity_expression | NULL
Теперь все еще неясно, что такое scalar_expression
или simple_entity_expression
. Но я боюсь, что вычислительное выражение типа x < y
не является подмножеством обоих.
В вашем простом примере вы можете обойти это, вызвав два обновления:
update Container container set container.obsolete = 1 where container.maxLaunchingTime < ?2
update Container container set container.obsolete = 0 where container.maxLaunchingTime >= ?2
Поскольку утверждается, что BNF для HQL UPDATE такой же, как и для JPQL, мы можем расширить разработку до JPQL BNF отсюда или wikibooks :
update_statement ::= update_clause [where_clause]
update_clause ::= UPDATE abstract_schema_name [[AS] identification_variable] SET update_item {, update_item}*
update_item ::= [identification_variable.]{state_field | single_valued_association_field}= new_value
new_value ::= simple_arithmetic_expression | string_primary | datetime_primary | boolean_primary | enum_primary simple_entity_expression | NULL
simple_arithmetic_expression ::= arithmetic_term | simple_arithmetic_expression {+ |- } arithmetic_term
simple_entity_expression ::= identification_variable | input_parameter
arithmetic_term ::= arithmetic_factor | arithmetic_term {* |/ } arithmetic_factor
arithmetic_factor ::= [{+ |-}] arithmetic_primary
arithmetic_primary ::= state_field_path_expression | numeric_literal | (simple_arithmetic_expression) | input_parameter | functions_returning_numerics | aggregate_expression
functions_returning_numerics ::= LENGTH(string_primary)| LOCATE(string_primary,string_primary [, simple_arithmetic_expression]) | ABS(simple_arithmetic_expression) | SQRT(simple_arithmetic_expression) | MOD(simple_arithmetic_expression, simple_arithmetic_expression) | SIZE(collection_valued_path_expression)
aggregate_expression ::= {AVG |MAX |MIN |SUM}([DISTINCT] state_field_path_expression) | COUNT ([DISTINCT] identification_variable | state_field_path_expression | single_valued_association_path_expression)
single_valued_association_path_expression ::= identification_variable.{single_valued_association_field.}* single_valued_association_field
string_primary ::= state_field_path_expression | string_literal | input_parameter | functions_returning_strings | aggregate_expression
datetime_primary ::= state_field_path_expression | input_parameter | functions_returning_datetime | aggregate_expression
boolean_primary ::= state_field_path_expression | boolean_literal | input_parameter |
enum_primary ::= state_field_path_expression | enum_literal | input_parameter |
where_clause ::= WHERE conditional_expression
...
Итак, наконец, мы можем видеть, что выражения типа set property = 4+5
или set property = 8/2
являются частью языка, а set proeprty = 1 < 3
- нет.