A criteria query that uses with clauses on multiple joins can insert the values for the query parameters in the wrong order
This only appears to affect joins that are added to the criteria in a different order than they appear in the POJO.
This appears to occur because CriteriaQueryTranslator, which adds the parameter values to the query, has a listing of the subcriteria in the order in which they were added to the criteria object and creates the list of parameter values based on that ordering, however, AbstractEntityJoinWalker initStatementString(), which adds the actual joins to the query string being generated, has a listing of the properties of the entity in the order in which they are enumerated in the actual entity object.
I will try to get a isolated test case and a pull request together by tomorrow.
This issue duplicates HHH-5645.
Eric Haas, thanks for the pull request. I've added it to HHH-5645.
I missed that one in my search. Thanks for catching the duplicate.