参数化查询:检查字段是否在SELECT语句中的值数组中

参数化查询:检查字段是否在SELECT语句中的值数组中,第1张

参数化查询:检查字段是否在SELECT语句中的值数组中

看一下Spring Data
Access网页
,特别是第11.7.3节,其中涵盖了使用NamedParameterJdbcTemplate构建’IN’子句

例如

NamedParameterJdbcTemplate jdbcTemplate = new NamedParameterJdbcTemplate(dataSource);String sql = "select * from emp where empno in (:ids)";List idList = new ArrayList(2);idList.add(new Long(7782));idList.add(new Long(7788));Map parameters = new HashMap();parameters.put("ids", idList);List emps = jdbcTemplate.query(sql, parameters, new EmpMapper());


欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/zaji/5675463.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存