Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.SqlParameter


    String sql = "insert into music.userrecommendedartist_import"
        + " (lastfm_user, artist_name, rank, contextartist1_name, contextartist2_name)"
        + " values (?,?,?,?,?)";
    BatchSqlUpdate batchUpdate = new BatchSqlUpdate(jdbcTemplate.getDataSource(), sql);
    batchUpdate.setBatchSize(1000);
    batchUpdate.declareParameter(new SqlParameter("lastfm_user", Types.VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("artist_name", Types.VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("rank", Types.INTEGER));
    batchUpdate.declareParameter(new SqlParameter("contextartist1_name", Types.VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("contextartist2_name", Types.VARCHAR));
   
    for (int i = 0; i < artists.size(); i++) {
      RecommendedArtist rec = artists.get(i);
      batchUpdate.update(new Object[]{user.getLastFmUsername(), rec.getArtist().getName(),
          i, name(rec.getContextArtist1()), name(rec.getContextArtist2())});
View Full Code Here


        sourceArtist.getName());

    String sql = "insert into music.artistrelation_import (source_id, target_artist_name, weight) values (?,?,?)";
    BatchSqlUpdate batchUpdate = new BatchSqlUpdate(jdbcTemplate.getDataSource(), sql);
    batchUpdate.setBatchSize(1000);
    batchUpdate.declareParameter(new SqlParameter("source_id", Types.INTEGER));
    batchUpdate.declareParameter(new SqlParameter("target_artist_name", Types.VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("weight", Types.FLOAT));

    for (ArtistRelation ar : ArtistRelations) {
      batchUpdate.update(new Object[]{
          sourceArtistId, ar.getTarget().getName(), ar.getMatch()});
    }
View Full Code Here

  @Override
  public void createTagInfo(List<TagInfo> tagInfos) {
    String sql = "insert into music.taginfo_import (tag_name, summary, content) values (?,?,?)";
    BatchSqlUpdate batchUpdate = new BatchSqlUpdate(jdbcTemplate.getDataSource(), sql);
    batchUpdate.setBatchSize(1000);
    batchUpdate.declareParameter(new SqlParameter("tag_name", VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("summary", VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("content", VARCHAR));
   
    for (TagInfo ti : tagInfos) {
      batchUpdate.update(new Object[]{ti.getTagName(),
          ti.getSummary(), ti.getContent()});
    }
View Full Code Here

  @Override
  public void deleteSubdirectories(String directory, Set<String> subDirectories) {
    String sql = "insert into library.directory_delete (path) values (?)";
    BatchSqlUpdate batchUpdate = new BatchSqlUpdate(jdbcTemplate.getDataSource(), sql);
    batchUpdate.declareParameter(new SqlParameter("path", Types.VARCHAR));
   
    for (String subDirectory : subDirectories) {
      batchUpdate.update(new Object[]{subDirectory});
    }
    batchUpdate.flush();
View Full Code Here

  @Override
  public void deleteFiles(String directory, Set<File> files) {
    String sql = "insert into library.file_delete (path, filename) values (?,?)";
    BatchSqlUpdate batchUpdate = new BatchSqlUpdate(jdbcTemplate.getDataSource(), sql);
    batchUpdate.declareParameter(new SqlParameter("path", Types.VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("filename", Types.VARCHAR));
   
    for (File file : files) {
      batchUpdate.update(new Object[]{file.getDirectory(), file.getFilename()});
    }
    batchUpdate.flush();
View Full Code Here

 
  private void batchInsert(List<MBArtist> artists) {
    String sql = "insert into music.mb_artist_import (artist_name, mbid, country_code, start_year, active) values (?,?,?,?,?)";
    BatchSqlUpdate batchUpdate = new BatchSqlUpdate(jdbcTemplate.getDataSource(), sql);
    batchUpdate.setBatchSize(1000);
    batchUpdate.declareParameter(new SqlParameter("artist_name", Types.VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("mbid", Types.VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("county_code", Types.VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("start_year", Types.SMALLINT));
    batchUpdate.declareParameter(new SqlParameter("active", Types.BOOLEAN));
   
    for (MBArtist artist : artists) {
      batchUpdate.update(new Object[]{artist.getName(), artist.getMbid(),
          artist.getCountryCode(), artist.getStartYear(), artist.isActive()});
    }
View Full Code Here

  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()});
    }
View Full Code Here

        "select * from music.get_artist_id(?)", artist.getName());

    String sql = "insert into music.artisttoptag_import (artist_id, tag_name, tag_count) values (?,?,?)";
    BatchSqlUpdate batchUpdate = new BatchSqlUpdate(jdbcTemplate.getDataSource(), sql);
    batchUpdate.setBatchSize(1000);
    batchUpdate.declareParameter(new SqlParameter("artist_id", Types.INTEGER));
    batchUpdate.declareParameter(new SqlParameter("tag_name", Types.VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("tag_count", Types.SMALLINT));

    for (Tag tag : tags) {
      batchUpdate.update(new Object[]{sourceArtistId, tag.getName(), tag.getCount()});
    }
    batchUpdate.flush();
View Full Code Here

 
  private void batchInsert(List<ArtistInfo> artistInfos) {
    String sql = "insert into music.artistinfo_import (artist_name, smallimageurl, mediumimageurl, largeimageurl, extralargeimageurl, listeners, playcount, biosummary, biocontent) values (?,?,?,?,?,?,?,?,?)";
    BatchSqlUpdate batchUpdate = new BatchSqlUpdate(jdbcTemplate.getDataSource(), sql);
    batchUpdate.setBatchSize(1000);
    batchUpdate.declareParameter(new SqlParameter("artist_name", Types.VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("smallImageUrl", Types.VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("mediumImageUrl", Types.VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("largeImageUrl", Types.VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("extraLargeImageUrl", Types.VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("listeners", Types.INTEGER));
    batchUpdate.declareParameter(new SqlParameter("playcount", Types.INTEGER));
    batchUpdate.declareParameter(new SqlParameter("biosummary", Types.VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("biocontent", Types.VARCHAR));
   
    for (ArtistInfo ai : artistInfos) {
      batchUpdate.update(new Object[]{ai.getArtist().getName(),
          ai.getSmallImageUrl(), ai.getMediumImageUrl(), ai.getLargeImageUrl(),
          ai.getExtraLargeImageUrl(), ai.getListeners(), ai.getPlayCount(),
View Full Code Here

    jdbcTemplate.update("truncate music.lastfmgroup_import");
   
    String sql = "insert into music.lastfmgroup_import (group_name) values (?)";
    BatchSqlUpdate batchUpdate = new BatchSqlUpdate(jdbcTemplate.getDataSource(), sql);
    batchUpdate.setBatchSize(1000);
    batchUpdate.declareParameter(new SqlParameter("group_name", Types.VARCHAR));
    for (LastFmGroup group : lastFmGroups) {
      batchUpdate.update(new Object[]{group.getName()});
    }
    batchUpdate.flush();
   
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.SqlParameter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.