Selecting where an entity contains a list thats a subset of another list

后端 未结 3 539
星月不相逢
星月不相逢 2020-12-05 20:19

I am writing a JPQL query and i have the following scenario. I have a Question entity which contains a list of Tags. I would like to select all Questions that contains a gi

3条回答
  •  一整个雨季
    2020-12-05 20:46

    Try like this:

    select distinct q from Question q join q.tags as t 
    where t.name in (:tags) 
    group by q.id, q.author, q.title, q.content,q.postedAt 
    having count(t.id) = :size
    

提交回复
热议问题