I have a query which returns a single row with four integer columns.
select col1, col2, col3, col4 from myTable where id='xyz';
Which query method should I use from JdbcTemplate and how to put the values in four int variables say int1, int2, int3, int4 ?
The rowMapper answers given below will not work probably in my case. Because I do not have a object having four int properties, which I can set.
I am running a independent query in a method and I want to set the returned four column result to four integers which are local variables to that method.
I want to know, is this achievable through JdbcTemplate ???
Is below code valid?
List<String> result = this.jdbcTemplate.queryForObject(myQuery, List.class);
Iterator i = result.iterator();
String a = (String) i.next();
String b = (String) i.next();
String c = (String) i.next();
String d = (String) i.next();