Criteria query with multiple with clauses puts parameter values in the wrong order

Description

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.

Environment

None

Activity

Show:
Eric Haas
July 16, 2014, 8:20 PM

I will try to get a isolated test case and a pull request together by tomorrow.

Eric Haas
July 21, 2014, 11:30 PM

It took longer than I had hoped due to other commitments, but here is the pull request:
https://github.com/hibernate/hibernate-orm/pull/776

Gail Badner
July 22, 2014, 5:42 AM

This issue duplicates HHH-5645.

Eric Haas, thanks for the pull request. I've added it to HHH-5645.

Eric Haas
July 22, 2014, 7:17 AM

I missed that one in my search. Thanks for catching the duplicate.

Assignee

Gail Badner

Reporter

Eric Haas

Fix versions

None

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Major
Configure