今天项目中遇到hibernate in查询结果集为空的问题.
temp是个map
这段执行后抛出异常.
修改后
String searchModules = "select m from Module m where m.id in (?)";
return find(searchModules, temp.keySet());
temp是个map
这段执行后抛出异常.
修改后
Object [] objects = temp.keySet().toArray();
StringBuffer ids = new StringBuffer();
for (Object object : objects) {
ids.append("'").append(object).append("'").append(',');
}
ids.deleteCharAt(ids.length() - 1);
String searchModules = "select m from Module m where m.id in ("+ids.toString()+")";
return find(searchModules);