I've got a (Criteria) sub-query which is generated somewhere else and where I want to add another restriction on the selection:
If I execute the associated query, I run into a StackOverflowException:
The problem is that the wrapper, which is returned by CriteriaSubqueryImpl.getSelection(), is not rendering the single expression, but the whole subquery instead.
This was introduced with HHH-7451, but I can't see where the JPA 2.1 spec explicitly requires this behavior. Maybe this is an obsolete leftover from the draft version?
You can find the test case attached.
Test case worked properly using 4.2.21.Final.