普通占位符 :shopId
In的占位符::(hids) 之后需要 qry.setParameterList(“hids”, hids)
具体代码 :
public List<String> getHouseLists(String shopId, List<String> hids) {
String sql = " SELECT id FROM JC_House WHERE shopId = :shopId AND h.id IN (:hids) ";
Query qry = super.getSession().createSQLQuery(sql).setString("shopId", shopId);
if (hids != null && hids.size() > 0) {
qry.setParameterList("hids", hids);
}
List<String> houseList = qry.list();
return houseList;
}