Class JdbcCursorItemReaderProperties

java.lang.Object
org.springframework.cloud.task.batch.autoconfigure.jdbc.JdbcCursorItemReaderProperties

@ConfigurationProperties(prefix="spring.batch.job.jdbccursoritemreader") public class JdbcCursorItemReaderProperties extends Object
Since:
2.3
Author:
Michael Minella
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Provides the index of the current item.
    int
    Provides the number of items to return each time the cursor fetches from the server.
    int
    The maximum number of items to be read.
    int
    Provides the maximum number of rows to read with this reader.
    Returns the configured value of the name used to calculate ExecutionContext keys.
    int
    Provides the time in milliseconds for the query to timeout.
    Returns the SQL query to be executed.
    boolean
    Provides if the driver supports absolute positioning of a cursor.
    boolean
    Provides if SQL warnings should be ignored.
    boolean
    Returns the configured value of if the state of the reader will be persisted.
    boolean
    Sets whether the connection used for the cursor is being used by all other processing and is, therefore, part of the same transaction.
    boolean
    Indicates if the cursor's position should be validated with each item read (to confirm that the RowMapper has not moved the cursor's location).
    void
    setCurrentItemCount(int currentItemCount)
    Index for the current item.
    void
    setDriverSupportsAbsolute(boolean driverSupportsAbsolute)
    Sets if the driver supports absolute positioning of a cursor.
    void
    setFetchSize(int fetchSize)
    Sets the number of items to return each time the cursor fetches from the server.
    void
    setIgnoreWarnings(boolean ignoreWarnings)
    Sets if SQL warnings should be ignored.
    void
    setMaxItemCount(int maxItemCount)
    Configure the max number of items to be read.
    void
    setMaxRows(int maxRows)
    Sets the maximum number of rows to be read with this reader.
    void
    The name used to calculate the key within the ExecutionContext.
    void
    setQueryTimeout(int queryTimeout)
    Sets the time in milliseconds for the query to timeout.
    void
    setSaveState(boolean saveState)
    Configure if the state of the ItemStreamSupport should be persisted within the ExecutionContext for restart purposes.
    void
    Sets the SQL query to be executed.
    void
    setUseSharedExtendedConnection(boolean useSharedExtendedConnection)
    Sets whether the the connection used for the cursor is being used by all other processing and is, therefore, part of the same transaction.
    void
    setVerifyCursorPosition(boolean verifyCursorPosition)
    Provides if the cursor's position should be validated with each item read.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JdbcCursorItemReaderProperties

      public JdbcCursorItemReaderProperties()
  • Method Details

    • isSaveState

      public boolean isSaveState()
      Returns the configured value of if the state of the reader will be persisted.
      Returns:
      true if the state will be persisted
    • setSaveState

      public void setSaveState(boolean saveState)
      Configure if the state of the ItemStreamSupport should be persisted within the ExecutionContext for restart purposes.
      Parameters:
      saveState - defaults to true
    • getName

      public String getName()
      Returns the configured value of the name used to calculate ExecutionContext keys.
      Returns:
      the name
    • setName

      public void setName(String name)
      The name used to calculate the key within the ExecutionContext. Required if setSaveState(boolean) is set to true.
      Parameters:
      name - name of the reader instance
      See Also:
      • ItemStreamSupport.setName(String)
    • getMaxItemCount

      public int getMaxItemCount()
      The maximum number of items to be read.
      Returns:
      the configured number of items, defaults to Integer.MAX_VALUE
    • setMaxItemCount

      public void setMaxItemCount(int maxItemCount)
      Configure the max number of items to be read.
      Parameters:
      maxItemCount - the max items to be read
      See Also:
      • AbstractItemCountingItemStreamItemReader.setMaxItemCount(int)
    • getCurrentItemCount

      public int getCurrentItemCount()
      Provides the index of the current item.
      Returns:
      item index
    • setCurrentItemCount

      public void setCurrentItemCount(int currentItemCount)
      Index for the current item. Also used on restarts to indicate where to start from.
      Parameters:
      currentItemCount - current index
      See Also:
      • AbstractItemCountingItemStreamItemReader.setCurrentItemCount(int)
    • getFetchSize

      public int getFetchSize()
      Provides the number of items to return each time the cursor fetches from the server.
      Returns:
      fetch size
    • setFetchSize

      public void setFetchSize(int fetchSize)
      Sets the number of items to return each time the cursor fetches from the server.
      Parameters:
      fetchSize - the number of items
      See Also:
      • JdbcCursorItemReaderBuilder.fetchSize(int)
    • getMaxRows

      public int getMaxRows()
      Provides the maximum number of rows to read with this reader.
      Returns:
      maxiumum number of items
    • setMaxRows

      public void setMaxRows(int maxRows)
      Sets the maximum number of rows to be read with this reader.
      Parameters:
      maxRows - maximum number of items
      See Also:
      • JdbcCursorItemReaderBuilder.maxRows(int)
    • getQueryTimeout

      public int getQueryTimeout()
      Provides the time in milliseconds for the query to timeout.
      Returns:
      milliseconds for the timeout
    • setQueryTimeout

      public void setQueryTimeout(int queryTimeout)
      Sets the time in milliseconds for the query to timeout.
      Parameters:
      queryTimeout - milliseconds
      See Also:
      • JdbcCursorItemReaderBuilder.queryTimeout(int)
    • isIgnoreWarnings

      public boolean isIgnoreWarnings()
      Provides if SQL warnings should be ignored.
      Returns:
      true if warnings should be ignored
    • setIgnoreWarnings

      public void setIgnoreWarnings(boolean ignoreWarnings)
      Sets if SQL warnings should be ignored.
      Parameters:
      ignoreWarnings - indicator if the warnings should be ignored
      See Also:
      • JdbcCursorItemReaderBuilder.ignoreWarnings(boolean)
    • isVerifyCursorPosition

      public boolean isVerifyCursorPosition()
      Indicates if the cursor's position should be validated with each item read (to confirm that the RowMapper has not moved the cursor's location).
      Returns:
      true if the position should be validated
    • setVerifyCursorPosition

      public void setVerifyCursorPosition(boolean verifyCursorPosition)
      Provides if the cursor's position should be validated with each item read.
      Parameters:
      verifyCursorPosition - true if the position should be validated
      See Also:
      • JdbcCursorItemReaderBuilder.verifyCursorPosition(boolean)
    • isDriverSupportsAbsolute

      public boolean isDriverSupportsAbsolute()
      Provides if the driver supports absolute positioning of a cursor.
      Returns:
      true if the driver supports absolute positioning
    • setDriverSupportsAbsolute

      public void setDriverSupportsAbsolute(boolean driverSupportsAbsolute)
      Sets if the driver supports absolute positioning of a cursor.
      Parameters:
      driverSupportsAbsolute - true if the driver supports absolute positioning
      See Also:
      • JdbcCursorItemReaderBuilder.driverSupportsAbsolute(boolean)
    • isUseSharedExtendedConnection

      public boolean isUseSharedExtendedConnection()
      Sets whether the connection used for the cursor is being used by all other processing and is, therefore, part of the same transaction.
      Returns:
      true if the connection is shared beyond this query
    • setUseSharedExtendedConnection

      public void setUseSharedExtendedConnection(boolean useSharedExtendedConnection)
      Sets whether the the connection used for the cursor is being used by all other processing and is, therefore, part of the same transaction.
      Parameters:
      useSharedExtendedConnection - true if the connection is shared beyond this query
      See Also:
      • JdbcCursorItemReaderBuilder.useSharedExtendedConnection(boolean)
    • getSql

      public String getSql()
      Returns the SQL query to be executed.
      Returns:
      the SQL query
    • setSql

      public void setSql(String sql)
      Sets the SQL query to be executed.
      Parameters:
      sql - the query
      See Also:
      • JdbcCursorItemReaderBuilder.sql(String)