参数为两个值时的HQL查询

时间:2018-08-12 15:38:59

标签: hibernate jpa spring-data-jpa hql

从学生ST那里ST.branch =:branch

setParameter(“ branch”,EC或CS)

谁能帮助我有效地编写此查询

1 个答案:

答案 0 :(得分:0)

您可以改用INsetParameterList-

List<String> branches = new ArrayList<String>();
branches.add("EC");
branches.add("CS");

From Student ST where ST.branch in (:branches)";
setParameterList("branches", branches);