Is there any way to select a collection contains any of another collection elements?

2.7k Views Asked by At

My Profile class has a collection attribute.

class Profile {
    private List<String> aliases;
}

How can I query for selecting Profiles whose aliases contains any of given collection?

Say, selecting profiles whose aliases contains any of [a, b, c]?

1

There are 1 best solutions below

0
On BEST ANSWER
where 'a' member of p.aliases or 'b' member of p.aliases or 'c' member of p.aliases

or

join p.aliases a where a in ('a','b','c')