JPQL and EQL renderers fail using TREAT, LOCATE, and subqueries from collection members (original) (raw)

JpqlQueryRenderer and EqlQueryRenderer are expected to re-render a parsed query unchanged, but three Jakarta Persistence spec-valid constructs are currently dropped or fail during rendering. All three parse fine in JPQL/EQL, and the same round-trip cases pass through the HQL renderer, so the failures are isolated to the JPQL/EQL visitors.

Construct Spec-valid input (abbrev.) Current behavior
TREAT(…) downcast in a path SELECT TREAT(VALUE(m) AS Employee) … SELECT VALUE(m) … — cast silently dropped
Two-argument LOCATE(…) LOCATE('a', e.name) NullPointerException while rendering
Subquery FROM collection member … FROM Order o2, IN(o2.lineItems) l … … FROM Order o2 … — member dropped, alias l left undefined

Each is independently reproducible against the current renderers. I can submit a focused PR with one commit per fix.