您的位置:首页 > 其它

JdbcTemplate使用别名绑定变量

2016-02-22 17:50 218 查看
MapSqlParameterSource  paramMap = new MapSqlParameterSource();
NamedParameterJdbcTemplate JdbcTemplate = new NamedParameterJdbcTemplate(this.getDataSource());
String[] newIds = ids.split(",");
List<Long> idsList = new ArrayList<Long>();
for (int i = 0; i < newIds.length; i++) {
idsList.add(Long.parseLong(newIds[i]));
}
paramMap.addValue("ids", idsList);
Integer count=JdbcTemplate.queryForInt(sql, paramMap);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: