Here you can find the source of getLimitedBatchSizePreparedStatement(PreparedStatement pstmt, int maxBatchSize)
executeBatch
method every maxBatchSize
th time a batch is added to the statement with the addBatch
method.
Parameter | Description |
---|---|
pstmt | the prepared statement to wrap |
maxBatchSize | the maximum batch size at which an executeBatch should be called |
public static PreparedStatement getLimitedBatchSizePreparedStatement(PreparedStatement pstmt, int maxBatchSize)
//package com.java2s; import java.sql.PreparedStatement; public class Main { /**//from w w w . j a v a 2 s . c o m * This method wraps the {@link PreparedStatement} given as argument * into a delegate object that calls the <code>executeBatch</code> * method every <code>maxBatchSize</code>th time a batch is added to * the statement with the <code>addBatch</code> method. * * @param pstmt the prepared statement to wrap * @param maxBatchSize the maximum batch size at which an executeBatch * should be called * @return a PreparedStatement implementation that does automatic * batch updates */ public static PreparedStatement getLimitedBatchSizePreparedStatement(PreparedStatement pstmt, int maxBatchSize) { return null; // new LimitedBatchSizePreparedStatement(pstmt, maxBatchSize); } }