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 -
Method Summary
Modifier and TypeMethodDescriptionintProvides the index of the current item.intProvides the number of items to return each time the cursor fetches from the server.intThe maximum number of items to be read.intProvides the maximum number of rows to read with this reader.getName()Returns the configured value of the name used to calculateExecutionContextkeys.intProvides the time in milliseconds for the query to timeout.getSql()Returns the SQL query to be executed.booleanProvides if the driver supports absolute positioning of a cursor.booleanProvides if SQL warnings should be ignored.booleanReturns the configured value of if the state of the reader will be persisted.booleanSets whether the connection used for the cursor is being used by all other processing and is, therefore, part of the same transaction.booleanIndicates if the cursor's position should be validated with each item read (to confirm that the RowMapper has not moved the cursor's location).voidsetCurrentItemCount(int currentItemCount) Index for the current item.voidsetDriverSupportsAbsolute(boolean driverSupportsAbsolute) Sets if the driver supports absolute positioning of a cursor.voidsetFetchSize(int fetchSize) Sets the number of items to return each time the cursor fetches from the server.voidsetIgnoreWarnings(boolean ignoreWarnings) Sets if SQL warnings should be ignored.voidsetMaxItemCount(int maxItemCount) Configure the max number of items to be read.voidsetMaxRows(int maxRows) Sets the maximum number of rows to be read with this reader.voidThe name used to calculate the key within theExecutionContext.voidsetQueryTimeout(int queryTimeout) Sets the time in milliseconds for the query to timeout.voidsetSaveState(boolean saveState) Configure if the state of theItemStreamSupportshould be persisted within theExecutionContextfor restart purposes.voidSets the SQL query to be executed.voidsetUseSharedExtendedConnection(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.voidsetVerifyCursorPosition(boolean verifyCursorPosition) Provides if the cursor's position should be validated with each item read.
-
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 theItemStreamSupportshould be persisted within theExecutionContextfor restart purposes.- Parameters:
saveState- defaults to true
-
getName
Returns the configured value of the name used to calculateExecutionContextkeys.- Returns:
- the name
-
setName
The name used to calculate the key within theExecutionContext. Required ifsetSaveState(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)
-
getSql
Returns the SQL query to be executed.- Returns:
- the SQL query
-
setSql
Sets the SQL query to be executed.- Parameters:
sql- the query- See Also:
-
JdbcCursorItemReaderBuilder.sql(String)
-