HQL how to query ElementCollection of String

后端 未结 3 1341
长情又很酷
长情又很酷 2021-01-01 00:02

I have class like

public User{
   Long id;
   Set roles;
}

How do I query all User objects with the role of

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-01 00:37

    This should do it:

    session.createQuery("from User where roles in ('ADMIN')");
    

提交回复
热议问题