我想检查集合(u.organisations
)中是否至少存在一个元素也在另一个集合(?
= excludedOrganisations)中:
select distinct u from SystemUser u
join u.userGroups g
join u.organisations o
where 3 in elements(g.permissions) and
EACH_ELEMENT_OF(o) not in (?)
我该如何使用HQL表达EACH_ELEMENT_OF
?
我的最后一次尝试是:
select distinct u from SystemUser u
join u.userGroups g
where 3 in elements(g.permissions) and
not exists (
select org from Organisation org
where org in elements(u.organisations)
and org not in (?)
)
但是我收到了异常:
IllegalArgumentException occurred calling getter of Organisation.id