"select ai.smallimageurl, ai.mediumimageurl, ai.largeimageurl, ai.extralargeimageurl, ai.listeners, ai.playcount from music.albuminfo ai" +
" inner join music.album alb on ai.album_id = alb.id" +
" inner join music.artist art on alb.artist_id = art.id" +
" where alb.album_name = upper(?) and art.artist_name = upper(?)";
AlbumInfo albumInfo = jdbcTemplate.queryForObject(sql,
new Object[]{album.getName(), album.getArtist().getName()},
new RowMapper<AlbumInfo>() {
@Override
public AlbumInfo mapRow(ResultSet rs, int rowNum)
throws SQLException {
AlbumInfo ai = new AlbumInfo();
ai.setAlbum(album);
ai.setSmallImageUrl(rs.getString(1));
ai.setMediumImageUrl(rs.getString(2));
ai.setLargeImageUrl(rs.getString(3));
ai.setExtraLargeImageUrl(rs.getString(4));
ai.setListeners(rs.getInt(5));
ai.setPlayCount(rs.getInt(6));
return ai;
}
});