Java 使用play framework在hibernate中绑定多个值

Java 使用play framework在hibernate中绑定多个值,java,hibernate,playframework,Java,Hibernate,Playframework,我正在尝试在Play框架中构建查询,我已经 select * from Candidate c where (:schools member of c.schools) 在我用一个元素绑定:school和List之后,它返回结果,但如果我用多个元素绑定List,则什么也不会发生 Caused by: org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: {vector} [select c from models.C

我正在尝试在Play框架中构建查询,我已经

select * from Candidate c where (:schools member of c.schools) 
在我用一个元素绑定:school和List之后,它返回结果,但如果我用多个元素绑定List,则什么也不会发生

Caused by: org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: {vector} [select c from models.Candidate c where (:schools0_, :schools1_ member of c.schools)  group by c.id order by RAND()]
事实上,我需要像这样的东西

select * from candidate where schools in (x,x,x,x,x);
考生和学校的关系在链接表中


有没有办法绑定多个值?

事实上,我发现问题出在哪里-的成员只能与单个值一起使用,而且效果很好。当我们需要使用多个值时,最好在中使用标准sql

 select c from Candidate c inner join c.schools as school where school.id in (25980,25981)"
连接链接表是必需的-我们不能使用c.schools.id,因此我们需要使用别名内部连接c.schools以指定列


我认为所有初学者都应该使用Hibernate检查,您也可以直接使用列表本身

select c from Candidate c join c.schools as school where school.id in (:schools)
:schools参数的类型是根据您的ID键入的,例如
List
List