Joining element collection on correlated inverse association produces wrong SQL

Description

Joining an element collection on a correlated inverse assocation within a subquery will cause invalid SQL to be generated.
Consider the simple model

When querying like SELECT ... FROM Person p WHERE EXISTS (SELECT ... FROM p.articles a JOIN a.coll) it will generate SQL like select ... from person person0_ where exists (select articles1_.id from left outer join article_localized localized2_ on articles1_.id=localized2_.article_id where person0_.id=articles1_.author_id).

Seems like the relation for the inverse association isn't rendered properly in this case.

Environment

None

Activity

Show:
Christian Beikov
October 14, 2018, 7:00 PM
Edited

Actually, it seems like the problem is in the handling of the WHERE clause within a subquery that uses a correlation when using the INDEX function in the WHERE clause. Tests with maps and the KEY function work. Don't know why it's just a problem for INDEX

Assignee

Unassigned

Reporter

Christian Beikov

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure