I am trying to write a query which will check if all items in an array belong in a single record.
Just like for two variables I can write
@Query( "from #{#entityName} c where c.channelType = 'group' and exists ( from UserChannel u where c.id = u.channel.id and u.user.id = :userId ) and exists (from UserChannel u where c.id = u.channel.id and u.user.id = :userId2)" )
Set< Channel > findGroupChannelsByUserIds( @Param( "userId" ) int userId, @Param( "userId2" ) int userId2 );
If my second parameter is an array of userids, how can I write the query then ?