Is it possible to generate arbitrary \"in ()\" lists in a SQL query through Jdbc template:
example:
\"select * from t where c in (#)\" , However \'#\' could
SimpleJDBCTemplate is depricated now. You can use NamedParameterJdbcTemplate instead.
Sample code is below.
If you have multiple parameters of different kind you can
use Object
as key, otherwise use your List
String sqlAllEmpl = queryLoader.getProperty("allEmployeesByLevelAndPeriod");
Map paramMap = new HashMap();
paramMap.put("level", levelStr);
paramMap.put("periodList", periodList);
gridList = namedParameterJdbcTemplate.query(sqlAllEmpl, paramMap, new YourRowMapper());
your sqlAllEmpl will have two place holders, level
- string and periodList
- which is a list used in the IN statement of sql.