Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.jdbc.object;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;
import javax.sql.DataSource;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
/**
* SqlUpdate subclass that performs batch update operations. Encapsulates
* queuing up records to be updated, and adds them as a single batch once
* {@code flush} is called or the given batch size has been met.
*
*
Note that this class is a non-thread-safe object, in contrast
* to all other JDBC operations objects in this package. You need to create
* a new instance of it for each use, or call {@code reset} before
* reuse within the same thread.
*
* @author Keith Donald
* @author Juergen Hoeller
* @since 1.1
* @see #flush
* @see #reset
*/
public class BatchSqlUpdate extends SqlUpdate {
/**
* Default number of inserts to accumulate before committing a batch (5000).
*/
public static final int DEFAULT_BATCH_SIZE = 5000;
private int batchSize = DEFAULT_BATCH_SIZE;
private boolean trackRowsAffected = true;
private final Deque