I am using JdbcTemplate
to retrieve a Bean from the db. Here is my method:
public List getTrackerData() {
return List
JdbcTemplate method
queryForList(String sql, Class elementType)
is useful for one-column-queries, you may only specify the column type. If you need more than one column in ResultSet, it's more accurate to use
query(String sql, RowMapper rowMapper)
as implementation for RowMapper you may use your own, or
jdbcTemplate.query(sql, new BeanPropertyRowMapper(clazz));
so in your case it may be:
public List getTrackerData() {
String sql = "SELECT * FROM mmitrackerv3_livedata mlive " +
"JOIN mmitrackerv3_device mdevice ON mlive.accountid = " +
"mdevice.accountid WHERE mlive.accountid = " + aid;
return jdbcTemplate.query(sql,
new BeanPropertyRowMapper(Trackerv3Livedata.class));
}