Raivis Kalinins commented on Bug HHH-7374

Upgraded to 4.1.5-SNAPSHOT and tried to run this query:

select count(r.id) from Record r
join r.address a
join a.country c
join c.countryTexts ct
where key(ct) = 'en' and value(ct) like '%Swed%'

which generates this query:

select count(recor0_.id) as col_0_0_ from record recor0_
inner join address address1_ on recor0_.address_id=address1_.id
inner join country country2_ on address1_.country_id=country2_.country_id
inner join country_text countrytex3_ on country2_.country_id=countrytex3_.country_id
where countrytex3_.locale='en' and ((select countrytex3_.country_text from country_text countrytex3_ where country2_.country_id=countrytex3_.country_id) like '%Swed%') limit ?

and then we obviously get cardinality violation error cause of the subquery
Is this how it should be?
I mean why is there a subquery instead of simply "countrytex3_.country_text" which is the value of the map?

@ElementCollection
@CollectionTable(name = "country_text", joinColumns = @JoinColumn(name = "country_id"))
@MapKeyColumn(name = "locale")
@Column(name = "country_text")
private Map<Locale, String> countryTexts = new HashMap<Locale, String>();

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira