Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.SqlParameter


 
  private void batchInsert(List<AlbumInfo> albumInfos) {
    String sql = "insert into music.albuminfo_import (artist_name, album_name, smallimageurl, mediumimageurl, largeimageurl, extraLargeimageurl, listeners, playcount) values (?,?,?,?,?,?,?,?)";
    BatchSqlUpdate batchUpdate = new BatchSqlUpdate(jdbcTemplate.getDataSource(), sql);
    batchUpdate.setBatchSize(1000);
    batchUpdate.declareParameter(new SqlParameter("artist_name", Types.VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("album_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));
   
    for (AlbumInfo ai : albumInfos) {
      batchUpdate.update(new Object[]{ai.getAlbum().getArtist().getName(), ai.getAlbum().getName(),
          ai.getSmallImageUrl(), ai.getMediumImageUrl(), ai.getLargeImageUrl(),
          ai.getExtraLargeImageUrl(), ai.getListeners(), ai.getPlayCount()});
View Full Code Here


 
  private void batchInsert(List<TrackPlayCount> trackPlayCounts) {
    String sql = "insert into library.trackplaycount_import (artist_name, track_name, play_count) values (?,?,?)";
    BatchSqlUpdate batchUpdate = new BatchSqlUpdate(jdbcTemplate.getDataSource(), sql);
    batchUpdate.setBatchSize(1000);
    batchUpdate.declareParameter(new SqlParameter("artist_name", Types.VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("track_name", Types.VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("play_count", Types.INTEGER));
   
    for (TrackPlayCount tpc : trackPlayCounts) {
      batchUpdate.update(new Object[]{tpc.getTrack().getArtist().getName(),
          tpc.getTrack().getName(), tpc.getPlayCount()});
    }
View Full Code Here

        "select * from music.get_artist_id(?)", artist.getName());
   
    String sql = "insert into music.artisttoptrack_import (artist_id, track_name, rank) values (?,?,?)";
    BatchSqlUpdate batchUpdate = new BatchSqlUpdate(jdbcTemplate.getDataSource(), sql);
    batchUpdate.setBatchSize(1000);
    batchUpdate.declareParameter(new SqlParameter("artist_id", Types.INTEGER));
    batchUpdate.declareParameter(new SqlParameter("track_name", Types.VARCHAR));
    batchUpdate.declareParameter(new SqlParameter("rank", Types.SMALLINT));
   
    short rank = 0;
    for (Track t : topTracks) {
      batchUpdate.update(new Object[]{sourceArtistId, t.getName(), ++rank});
    }
View Full Code Here

      this.request=request;
      this.handler=handler;
      int[] types=request.getTypes();
      if( types!=null ) {
        for(int cpt=0;cpt<types.length;cpt++) {
          super.declareParameter(new SqlParameter(types[cpt]));
        }
      }
      compile();
    }
View Full Code Here

      this.request = request;
      this.handler = handler;
      int[] types = request.getTypes();
      if( types!=null ) {
        for(int cpt=0; cpt<types.length; cpt++) {
          super.declareParameter(new SqlParameter(types[cpt]));
        }
      }
      compile();
    }
View Full Code Here

  private class CategoryMappingQuery extends MappingSqlQuery {

    public CategoryMappingQuery(DataSource ds) {
      super(ds, "SELECT CATEGORY_ID,CATEGORY_NAME FROM CATEGORY WHERE CATEGORY_ID=?");
      super.declareParameter(new SqlParameter("id", Types.INTEGER));
      compile();
    }
View Full Code Here

   * Query object to look up a user.
   */
  protected class UsersByCaidMapping extends MappingSqlQuery {
    protected UsersByCaidMapping(DataSource ds) {
      super(ds, usersByCaidQuery);
      declareParameter(new SqlParameter(Types.VARCHAR));
      compile();
    }
View Full Code Here

            return authority;
        }

        protected CustomAuthoritiesByUsernameMapping(DataSource ds) {
            super(ds, CustomJdbcDaoImpl.this.getAuthoritiesByUsernameQuery());
            declareParameter(new SqlParameter(Types.VARCHAR));
            declareParameter(new SqlParameter(Types.VARCHAR));
            declareParameter(new SqlParameter(Types.VARCHAR));
            compile();
        }
View Full Code Here

  class SelectByName extends AbstractSelect {

    public SelectByName(DataSource dataSource) {
      super(dataSource, SELECT_BY_NAME_SQL);
      declareParameter(new SqlParameter(Types.VARCHAR));
    }
View Full Code Here

  }
 
  class Update extends SqlUpdate {
    public Update(DataSource dataSource) {
      super(dataSource, UPDATE_SQL);
      declareParameter(new SqlParameter(Types.VARCHAR))// Name
      declareParameter(new SqlParameter(Types.INTEGER))// TestId
    }
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.