I have a code like this.
queryFactory.select(...)
.from(A)
.innerJoin(B).on(A.b.eq(B))
.innerJoin(C).on(A.c.eq(C))
// ... some other joins which depends on C ...
.where(...)
.fetch();
I am expecting to get a SQL Query which looks something like that:
select ... from A
inner join B
on A.b.id = B.id
inner join C
on A.c.id = C.id
//... some other joins which depends on C ...
but Hibernate rearranges the joins which causes error in the SQL and the SQL Query looks like this:
select ... from A
inner join B
on A.b.id = B.id
//... some other joins which depends on C ... (don't have C at this point)
inner join C
on A.c.id = C.id
The problem cames after updating Hibernate from 5.4.32 to 6.1.6