Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.InterruptibleBatchPreparedStatementSetter


      @Override
      public int[] doInPreparedStatement(PreparedStatement ps) throws SQLException {
        try {
          int batchSize = pss.getBatchSize();
          InterruptibleBatchPreparedStatementSetter ipss = null;
          if (pss instanceof InterruptibleBatchPreparedStatementSetter) {
            ipss = (InterruptibleBatchPreparedStatementSetter) pss;
          }
          if (JdbcUtils.supportsBatchUpdates(ps.getConnection())) {
            for (int i = 0; i < batchSize; i++) {
              pss.setValues(ps, i);
              if (ipss != null && ipss.isBatchExhausted(i)) {
                break;
              }
              ps.addBatch();
            }
            int[] rows = ps.executeBatch();
            return processResult(ps, rows, true);
          } else {
            List<Integer> rowsAffected = new ArrayList<Integer>();
            int[] rows = new int[1];
            for (int i = 0; i < batchSize; i++) {
              pss.setValues(ps, i);
              if (ipss != null && ipss.isBatchExhausted(i)) {
                break;
              }
              int rowAffected = ps.executeUpdate();
              rows[0] = rowAffected;
              rowsAffected.add(rowAffected);
View Full Code Here

TOP

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

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.