Class BatchedQuery

  • All Implemented Interfaces:
    Query

    public class BatchedQuery
    extends SimpleQuery
    Purpose of this object is to support batched query re write behaviour. Responsibility for tracking the batch size and implement the clean up of the query fragments after the batch execute is complete. Intended to be used to wrap a Query that is present in the batchStatements collection.
    • Field Detail

      • sql

        private java.lang.String sql
      • valuesBraceOpenPosition

        private final int valuesBraceOpenPosition
      • valuesBraceClosePosition

        private final int valuesBraceClosePosition
      • batchSize

        private final int batchSize
    • Constructor Detail

      • BatchedQuery

        public BatchedQuery​(NativeQuery query,
                            TypeTransferModeRegistry transferModeRegistry,
                            int valuesBraceOpenPosition,
                            int valuesBraceClosePosition,
                            boolean sanitiserDisabled)
      • BatchedQuery

        private BatchedQuery​(BatchedQuery src,
                             int batchSize)
    • Method Detail

      • deriveForMultiBatch

        public BatchedQuery deriveForMultiBatch​(int valueBlock)
      • getBatchSize

        public int getBatchSize()
        Description copied from interface: Query
        Get the number of times this Query has been batched.
        Specified by:
        getBatchSize in interface Query
        Overrides:
        getBatchSize in class SimpleQuery
        Returns:
        number of times addBatch() has been called.
      • getNativeSql

        public java.lang.String getNativeSql()
        Method to return the sql based on number of batches. Skipping the initial batch.
        Specified by:
        getNativeSql in interface Query
        Overrides:
        getNativeSql in class SimpleQuery
        Returns:
        SQL in native for database format
      • toString

        public java.lang.String toString​(ParameterList params,
                                         SqlSerializationContext context)
        Description copied from interface: Query
        Returns string representation of the query, substituting particular parameter values for parameter placeholders.
        Specified by:
        toString in interface Query
        Overrides:
        toString in class SimpleQuery
        Parameters:
        params - a ParameterList returned by this Query's Query.createParameterList() method, or null to leave the parameter placeholders unsubstituted.
        context - specifies configuration for converting the parameters to string
        Returns:
        string representation of this query