Repository navigation
Description
Problem
The GORM criteria / where DSL has one syntax and several interpretations. Each engine (Hibernate 5, JpaQueryBuilder for bulk statements, Hibernate 7, Neo4j) walks the criteria tree itself and decides what a property name, an alias path or an operand means. The shared pieces cover only one decision each (FunctionComparison for function comparisons, CriterionScope for Neo4j property lookup, ExpressionResolver.aliasPath for Hibernate alias joins), not the walk.
So the same input means different things per engine, and review findings repeat in a new place each time:
- A relationship block in Neo4j looked a property up on the owner, so a name that was an association on the owner and a string on the relationship threw (Neo4j: isNull and isNotNull on an association test the relationship #16836).
createAlias('this.owner', 'o')andcreateAlias('address.country', 'c')(embedded segment) throw on the Hibernate 5 builder (Keep every alias of an association path in a DetachedCriteria when the datastore opts in (#16851) #16890) and are resolved in different code on Hibernate 7.- A function in a read path works on Hibernate 7 and not on Hibernate 5; an entity or empty
inis accepted by Hibernate 7 and rejected by Hibernate 5; a function compared with a subquery without a projection failed only in the bulk builder (fix(hibernate7): support where-query functions and refactor PredicateGenerator #16816).
Each fix lands in one engine, and the next review finds the neighbour.
Proposal for 10.0
One engine-neutral resolution step in datastore-core: criteria tree + root entity in, resolved form out. The engines only render it as HQL, JPQL or Cypher.
- what each property name is: plain, identity, association, embedded, end of a relationship, function result
- what each alias path joins
- which operand shape each comparison has
How to get there safely
- One shared grid (criterion x property kind x alias shape x nesting) run unchanged against every engine. Mark each cell same, different on purpose, or different by accident. The accidental cells are the work. fix(hibernate7): support where-query functions and refactor PredicateGenerator #16816 (612 cells) and Neo4j: isNull and isNotNull on an association test the relationship #16836 (105 cells) are the first two such grids.
- Move the decisions into the resolver one at a time, starting with property kind.
- Keep Hibernate 5 behavior as the reference unless a difference is documented as intended.
Not for 8.0.x or 8.1.x: it changes a read path that works today, in four engines.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity
[-]Criteria/where DSL: resolve property, alias and operand meaning once, not per engine[/-][+]Criteria/where DSL: resolve property, alias and operand meaning once, not per engine (10.0)[/+]