In the following query
select distinct alert.id from Alert as alert where alert.id in (select a.id from Alert a join a.clientImpacts as i where i.clientId like ?)
the HQL console marks the "i.clientId" property red with a tooltip on hover stating "cannot resolve expression". The mappings do indeed specify that property:
<class name="Alert" table="Alerts">
<id name="id" column="AlertId" type="integer">
<generator class="native"/>
</id>
<property name="actionLog" column="ActionLog" type="text"/>
[...]
<list name="clientImpacts" table="ClientImpacts">
<key column="AlertId"/>
<index column="clientImpactIndex"/>
<composite-element class="ClientImpact">
<property name="clientId" column="ClientId" type="string" not-null="true" length="64"/>
<many-to-one name="serviceType" column="ServiceTypeId" class="ServiceType"/>
<property name="value" column="ImpactValue" type="double"/>
<many-to-one name="impactType" column="ImpactTypeId" class="ImpactType"/>
</composite-element>
</list>
</class>
[...]
The HQL console itself correctly translates the query to SQL when asked:
select distinct alert.id from Alert as alert where alert.id in (select a.id from Alert a join a.clientImpacts as i where i.clientId like ?)
SQL #1 types: integer
select
distinct alert0_.AlertId as col_0_0_
from
Alerts alert0_
where
alert0_.AlertId in (
select
alert1_.AlertId
from
Alerts alert1_
inner join
ClientImpacts clientimpa2_
on alert1_.AlertId=clientimpa2_.AlertId
where
clientimpa2_.ClientId like ?
)
Issue was resolved