the join generated are wrongly ordering

Description

however the order of the createCriteria, the Restrictions.conjunction() is at the bad place and generate a sql error.

1 2 3 4 5 6 criteria.createAlias("a.b", "b", JoinType.LEFT_OUTER_JOIN); criteria.createCriteria("a.d", "d", JoinType.LEFT_OUTER_JOIN); criteria.createCriteria("b.c", "c", JoinType.LEFT_OUTER_JOIN, Restrictions.conjunction() .add(Restrictions.eqProperty("c.code", "b.code")) .add(Restrictions.eqProperty("c.month", "d.month")) );

generate

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 select this_.id as id1_0_5_, this_.b_id as b_id2_0_5_, b1_.id as id1_2_0_, b1_.code as code2_2_0_, c6_.B_id as B_id1_2_7_, c3_.id as c_id2_3_7_, c3_.id as id1_4_1_, c3_.code as code2_4_1_, c3_.month as month3_4_1_, d8_.A_id as A_id1_0_, d2_.id as d_id2_1_, d2_.id as id1_5_2_, d2_.a_id as a_id3_5_2_, d2_.b_id as b_id4_5_2_, d2_.month as month2_5_2_, a10_.id as id1_0_3_, a10_.b_id as b_id2_0_3_, b11_.id as id1_2_4_, b11_.code as code2_2_4_ from A this_ left outer join B b1_ on this_.b_id=b1_.id left outer join B_C c6_ on b1_.id=c6_.B_id and ( ( c3_.code=b1_.code and c3_.month=d2_.month ) ) left outer join C c3_ on c6_.c_id=c3_.id and ( ( c3_.code=b1_.code and c3_.month=d2_.month ) ) left outer join A_D d8_ on this_.id=d8_.A_id left outer join D d2_ on d8_.d_id=d2_.id left outer join A a10_ on d2_.a_id=a10_.id left outer join B b11_ on d2_.b_id=b11_.id

That created a error :

Unknown column 'c3_.code'

Environment

  • MySql

  • H2

Status

Assignee

Unassigned

Reporter

alexis gayte

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

4.3.6
4.2.16
5.0.5

Priority

Major
Configure