Using a correlation with Joining an element collection on a correlated inverse assocation in within a subquery will cause invalid SQL to be generated. Consider the simple model
{code} @Entity class Person { // other fields.. @OneToMany(mappedBy = "author") Set<Article> articles; } @Entity class Article { // other fields.. @ManyToOne Person author; @ElementCollection Map<Integer, String> coll; } {code}
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 article2_ article_localized localized2_ on articles1_.id= article2_ localized2_ .article_id where person0_.id=articles1_.author_id)}}.
Seems like the relation for the inverse association isn't rendered properly in this case. |
|