If my SQL is:
select id, name, age from my_table where id in (...)
(we want to pass in the in values as arguments).
We have a our ID values
List<Integer> = new ArrayList<Integer>(Arrays.asList(111,222,333));
A person object
public class Person
{
private int id;
private int age;
private String name;
//getters setters, constructors
}
Now I want to use the jdbcTemplate to execute the SQL such that I get a List<Person>
returned.
I've already created a method that will convert the sql string into
select id, name, age from my_table where id in (?,?,?)
if that helps.
Looking at the JdbcTemplate javadoc it looks like I'd want to use one of the queryForList
methods.