org.springframework.jdbc.core.support

Class AbstractInterruptibleBatchPreparedStatementSetter

  • java.lang.Object
    • org.springframework.jdbc.core.support.AbstractInterruptibleBatchPreparedStatementSetter
    • Constructor Detail

      • AbstractInterruptibleBatchPreparedStatementSetter

        public AbstractInterruptibleBatchPreparedStatementSetter()
    • Method Detail

      • setValues

        public final void setValues(java.sql.PreparedStatement ps,
                                    int i)
                             throws java.sql.SQLException
        This implementation calls setValuesIfAvailable(java.sql.PreparedStatement, int) and sets this instance's exhaustion flag accordingly.
        Specified by:
        setValues in interface BatchPreparedStatementSetter
        Parameters:
        ps - the PreparedStatement to invoke setter methods on
        i - index of the statement we're issuing in the batch, starting from 0
        Throws:
        java.sql.SQLException - if a SQLException is encountered (i.e. there is no need to catch SQLException)
      • getBatchSize

        public int getBatchSize()
        This implementation returns Integer.MAX_VALUE. Can be overridden in subclasses to lower the maximum batch size.
        Specified by:
        getBatchSize in interface BatchPreparedStatementSetter
        Returns:
        the number of statements in the batch
      • setValuesIfAvailable

        protected abstract boolean setValuesIfAvailable(java.sql.PreparedStatement ps,
                                                        int i)
                                                 throws java.sql.SQLException
        Check for available values and set them on the given PreparedStatement. If no values are available anymore, return false.
        Parameters:
        ps - the PreparedStatement we'll invoke setter methods on
        i - index of the statement we're issuing in the batch, starting from 0
        Returns:
        whether there were values to apply (that is, whether the applied parameters should be added to the batch and this method should be called for a further iteration)
        Throws:
        java.sql.SQLException - if a SQLException is encountered (i.e. there is no need to catch SQLException)