ITeye博客

Hibernate in 出现的问题

wangyu · 2010-02-07 09:04 · 企业架构 · Markdown

今天项目中遇到hibernate in查询结果集为空的问题.

	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);

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。