我第一次尝试番石榴,我发现它真的很棒。
我在 Spring jdbc 模板上执行了几个参数化检索查询。DAO ( AbstractDataAccessObject
) 中的方法是这样的。这里没问题。
public Map<String,Object> getResultAsMap(String sql, Map<String,Object> parameters) {
try {
return jdbcTemplate.queryForMap(sql, parameters);
} catch (EmptyResultDataAccessException e) {
//Ignore if no data found for this query
logger.error(e.getMessage(), e);
}
return null;
}
这是问题所在:
当我使用调用此方法时
getResultAsMap(query, new HashMap<String,Object>(ImmutableMap.of("gciList",gciList)));
效果很好。
但是当我这样做时
getResultAsMap(query, Maps.newHashMap(ImmutableMap.of("gciList",gciList)));
编译器生气地说
The method getResultAsMap(String, Map<String,Object>) in the type AbstractDataAccessObject is not applicable for the arguments (String, HashMap<String,List<String>>)
我是不是做错了什么,或者这个投诉的原因是什么?