Skip to content

Instantly share code, notes, and snippets.

@panlw
Created May 13, 2018 14:51
Show Gist options
  • Save panlw/a769c632dd5d695675d691e1be389a0f to your computer and use it in GitHub Desktop.
Save panlw/a769c632dd5d695675d691e1be389a0f to your computer and use it in GitHub Desktop.
// @see https://stackoverflow.com/questions/1327074/how-to-execute-in-sql-queries-with-springs-jdbctemplate-effectivly
Set<Integer> ids = ...;
MapSqlParameterSource parameters = new MapSqlParameterSource();
parameters.addValue("ids", ids);
List<Foo> foo = getJdbcTemplate().query("SELECT * FROM foo WHERE a IN (:ids)",
parameters, getRowMapper());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment