日期:2014-05-16 浏览次数:20493 次
private List<Long> toNormalizedList(List<Long> idList) { List<Long> newList = new ArrayList<Long>(); newList.addAll(idList); for (int i = idList.size() + 1; i <= 100; i++) { // 填满100个,使得每个prepared // statement都有100参数,以充分利用sql缓存 newList.add(idList.get(0)); } return newList; }
<select id="batchGet" parameterClass="list" resultClass="java.lang.Long"> select distinct * from some_table where id in <iterate open="(" close=")" conjunction=","> #[]# </iterate> </select>