Join ordering logic wrongly pushes cross joins from subqueries to parent

Description

The logic in org.hibernate.hql.internal.ast.tree.FromClause#moveFromElementToEnd is faulty as it doesn't handle the fact that destination from elements could be on a different from clause level, leading to wrong SQL being generated.

Environment

None
Fixed

Assignee

Christian Beikov

Reporter

Christian Beikov

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

5.4.23

Components

Affects versions

Priority

Critical