Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.BatchPreparedStatementSetter


      int start = i * this.batchSize;
      int end = (i + 1) * this.batchSize;
      if (end > l.size())
        end = l.size();
      final List<T> chunkList = l.subList(start, end);
      jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {

        @Override
        public int getBatchSize() {
          return chunkList.size();
        }
View Full Code Here


     *
     * @param acl containing the ACEs to insert
     */
    protected void createEntries(final MutableAcl acl) {
        jdbcTemplate.batchUpdate(insertEntry,
            new BatchPreparedStatementSetter() {
                public int getBatchSize() {
                    return acl.getEntries().size();
                }

                public void setValues(PreparedStatement stmt, int i) throws SQLException {
View Full Code Here

  @Override
  public void write(final List<? extends T> items) {
    final ListIterator<? extends T> itemIterator = items.listIterator();

    getJdbcTemplate().batchUpdate("INSERT into BATCH_STAGING (ID, JOB_ID, VALUE, PROCESSED) values (?,?,?,?)",
        new BatchPreparedStatementSetter() {
      @Override
      public int getBatchSize() {
        return items.size();
      }
View Full Code Here

      return new int[] {0};
    }
    String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, batchArgs[0]);
    return jdbcOperations.batchUpdate(
        sqlToUse,
        new BatchPreparedStatementSetter() {

          @Override
          public void setValues(PreparedStatement ps, int i) throws SQLException {
            Object[] values = NamedParameterUtils.buildValueArray(parsedSql, batchArgs[i], null);
            int[] columnTypes = NamedParameterUtils.buildSqlTypeArray(parsedSql, batchArgs[i]);
View Full Code Here

  private int[] executeBatchInternal(final List<Object>[] batchValues) {
    if (logger.isDebugEnabled()) {
      logger.debug("Executing statement " + getInsertString() + " with batch of size: " + batchValues.length);
    }
    return getJdbcTemplate().batchUpdate(getInsertString(),
        new BatchPreparedStatementSetter() {
          @Override
          public void setValues(PreparedStatement ps, int i) throws SQLException {
            List<Object> values = batchValues[i];
            setParameterValues(ps, values, getInsertTypes());
          }
View Full Code Here

    if (logger.isDebugEnabled()) {
      logger.debug("Executing statement " + getInsertString() + " with batch of size: " + batchValues.length);
    }
    int[] updateCounts = jdbcTemplate.batchUpdate(
        getInsertString(),
        new BatchPreparedStatementSetter() {

          public void setValues(PreparedStatement ps, int i) throws SQLException {
            List<Object> values = batchValues[i];
            setParameterValues(ps, values, getInsertTypes());
          }
View Full Code Here

      return new int[] {0};
    }
    String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, batchArgs[0]);
    return jdbcOperations.batchUpdate(
        sqlToUse,
        new BatchPreparedStatementSetter() {

          public void setValues(PreparedStatement ps, int i) throws SQLException {
            Object[] values = NamedParameterUtils.buildValueArray(parsedSql, batchArgs[i], null);
            int[] columnTypes = NamedParameterUtils.buildSqlTypeArray(parsedSql, batchArgs[i]);
            setStatementParameters(values, ps, columnTypes);
View Full Code Here

      return new int[0];
    }
   
    int[] rowsAffected = getJdbcTemplate().batchUpdate(
        getSql(),
        new BatchPreparedStatementSetter() {
          public int getBatchSize() {
            return parameterQueue.size();
          }
          public void setValues(PreparedStatement ps, int index) throws SQLException {
            Object[] params = parameterQueue.removeFirst();
View Full Code Here

    if (logger.isDebugEnabled()) {
      logger.debug("Executing statement " + getInsertString() + " with batch of size: " + batchValues.length);
    }
    int[] updateCounts = jdbcTemplate.batchUpdate(
        getInsertString(),
        new BatchPreparedStatementSetter() {

          public void setValues(PreparedStatement ps, int i) throws SQLException {
            List<Object> values = batchValues[i];
            setParameterValues(ps, values, getInsertTypes());
          }
View Full Code Here

   */
  private void persistSerializedContexts(final Map<Long, String> serializedContexts, String sql) {
        if (!serializedContexts.isEmpty()) {
            final Iterator<Long> executionIdIterator = serializedContexts.keySet().iterator();

            getJdbcTemplate().batchUpdate(getQuery(sql), new BatchPreparedStatementSetter() {
                @Override
                public void setValues(PreparedStatement ps, int i) throws SQLException {
                    Long executionId = executionIdIterator.next();
                    String serializedContext = serializedContexts.get(executionId);
                    String shortContext;
View Full Code Here

TOP

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

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.