Jin Kwon
Jin Kwon

Reputation: 22007

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

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]?

Upvotes: 2

Views: 2799

Answers (1)

Peter Š&#225;ly
Peter Š&#225;ly

Reputation: 2933

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')

Upvotes: 6

Related Questions