use of com.github.hakko.musiccabinet.domain.model.music.ArtistPlayCount in project musiccabinet by hakko.
the class JdbcGroupWeeklyArtistChartDao method batchInsert.
private void batchInsert(GroupWeeklyArtistChart artistChart) {
String sql = "insert into music.groupweeklyartistchart_import (lastfmgroup_name, artist_name, playcount) values (?,?,?)";
BatchSqlUpdate batchUpdate = new BatchSqlUpdate(jdbcTemplate.getDataSource(), sql);
batchUpdate.setBatchSize(1000);
batchUpdate.declareParameter(new SqlParameter("lastfmgroup_name", Types.VARCHAR));
batchUpdate.declareParameter(new SqlParameter("artist_name", Types.VARCHAR));
batchUpdate.declareParameter(new SqlParameter("playcount", Types.INTEGER));
for (ArtistPlayCount apc : artistChart.getArtistPlayCounts()) {
batchUpdate.update(new Object[] { artistChart.getGroupName(), apc.getArtist().getName(), apc.getPlayCount() });
}
batchUpdate.flush();
}
Aggregations