I am trying to run a sql statment
select `key`, avg(score) from score group by `key`
List<MarkupScore> scores = mysqlDbTemplate.query(sql, new BeanPropertyRowMapper(MarkupScore.class));
select avg(score) from score
Since you're mapping the values with
BeanPropertyRowMapper, it's trying to map a column named
avg(score) to a similarly named property which doesn't exist. Give the
avg(score) an alias (i.e.
avg(score) AS score) that maps to the correct property in
And when asking a question, include all the necessary information.