Hql在列表中的条款

时间:2012-02-10 12:47:45

标签: many-to-many hql

我想像这样进行查询

createQuery("FROM Grouping g WHERE :user IN g.groupMembers OR :userId=g.groupAdminId")

但是hibernate将其转换为

snuser2_.id and ('12' in (.) or '12'=grouping0_.groupAdminId)

g.groupMembers是一个List(@ManyToMany),我该如何使用IN运算符?

1 个答案:

答案 0 :(得分:1)

from Grouping g where :user member of g.groupMembers or g.groupAdminId = :userId