We're updating the issue view to help you get more done. 

Query not built properly when joining a table based on class

Description

Here is excerpt from the HQL that we are using (that worked properly in 3.2.7):

1 select ... from SettlementTask as rootAlias join rootAlias.linked as _linked left join _linked.extensions as _extensions with _extensions.class=com.walkaway.claim.domain.settlement.extension.i3.EwtAssessmentExtension

Here is the resulting SQL that is produced:

1 left outer join claim_settlement_ext extensions7_ on settlement3_.id=extensions7_.settlement_id and (case when extensions7_1_.extension_id is not null then 1 when extensions7_2_.extension_id is not null then 2 when extensions7_3_.extension_id is not null then 3 when extensions7_4_.extension_id is not null then 4 when extensions7_5_.extension_id is not null then 5 when extensions7_6_.extension_id is not null then 6 when extensions7_.id is not null then 0 end=1) left outer join claim_settlement_ext_i3_ewt extensions7_1_ on extensions7_.id=extensions7_1_.extension_id left outer join claim_settlement_ext_walkaway_dr extensions7_2_ on extensions7_.id=extensions7_2_.extension_id left outer join claim_settlement_ext_walkaway_gap extensions7_3_ on extensions7_.id=extensions7_3_.extension_id left outer join claim_settlement_ext_walkaway_pr extensions7_4_ on extensions7_.id=extensions7_4_.extension_id left outer join claim_settlement_ext_walkaway_ccr extensions7_5_ on extensions7_.id=extensions7_5_.extension_id left outer join claim_settlement_ext_walkaway_vr extensions7_6_ on extensions7_.id=extensions7_6_.extension_id

The error message we are seeing is:

ERROR: missing FROM-clause entry for table "extensions7_1_"

I am fully aware that the 'with' attribute has been deprecated in favour of the 'type' attribute, but this query did get generated properly in 3.2.7, and now in 5.2.9 it does not.

Environment

None

Status

Assignee

Unassigned

Reporter

Randy May

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

3.2.7

Affects versions

5.2.9

Priority

Minor