-
Type:
New Feature
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: Query
Support computed expressions in HQL SELECT projections and WHERE predicates, translated to MongoDB aggregation expressions.
Supported:
- Arithmetic operators: +,
, *, /, div (integer division), unary +/. Integer division truncates via $toInt($divide) ($toLong for a BIGINT result), since MongoDB's $divide always returns a double (independent of PORTABLE_INTEGER_DIVISION). - Criteria API operators: CriteriaBuilder.quot (behaviorally identical to /) and CriteriaBuilder.mod (-> $mod).
- Comparison operators: >, >=, <, <=, =, <> — as a value in SELECT (e.g. select x > 1), and with computed operands in WHERE via $expr (e.g. where x + 1 > 5, where x > y).
- Scalar predicate family as value-producing expressions (in a SELECT item or as an operand): AND/OR junctions (
> $and/$or), NOT (> $not), IN list (> $in), LIKE (> $regexMatch), IS NULL / IS NOT NULL (> $eq/$ne against null, including a computed operand), BETWEEN / NOT BETWEEN (> $and of $gte/$lte bounds, negated $or of $lt/$gt; a computed operand or bound falls back to $expr, extending the compact filter form fromHIBERNATE-89), and boolean fields (-> $eq against true/false).
Out of scope (tracked separately):
- Function calls as operands, including HQL % / mod() (rewritten to a mod() function call, unlike Criteria's mod which is the MODULO operator): HIBERNATE-196
- CASE expressions: HIBERNATE-83
Hibernate User Guide: https://docs.jboss.org/hibernate/orm/6.6/userguide/html_single/Hibernate_User_Guide.html#hql-expressions
- is depended on by
-
HIBERNATE-198 Support expressions in HQL bulk UPDATE SET clause
-
- Closed
-
-
HIBERNATE-196 Support function calls as operands in aggregation expressions
-
- Needs Triage
-
-
HIBERNATE-197 Support IS NULL on computed expressions
-
- Needs Triage
-