Class JpaCursorItemReaderBuilder<T>
java.lang.Object
org.springframework.batch.item.database.builder.JpaCursorItemReaderBuilder<T>
Builder for
JpaCursorItemReader
.- Since:
- 4.3
- Author:
- Mahmoud Ben Hassine
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Returns a fully constructedJpaCursorItemReader
.currentItemCount
(int currentItemCount) Index for the current item.entityManagerFactory
(jakarta.persistence.EntityManagerFactory entityManagerFactory) TheEntityManagerFactory
to be used for executing the configuredqueryString
.maxItemCount
(int maxItemCount) Configure the max number of items to be read.The name used to calculate the key within theExecutionContext
.parameterValues
(Map<String, Object> parameterValues) A map of parameter values to be set on the query.queryProvider
(JpaQueryProvider queryProvider) A query provider.queryString
(String queryString) The JPQL query string to execute.saveState
(boolean saveState) Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.
-
Constructor Details
-
JpaCursorItemReaderBuilder
public JpaCursorItemReaderBuilder()
-
-
Method Details
-
saveState
Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.- Parameters:
saveState
- defaults to true- Returns:
- The current instance of the builder.
-
name
The name used to calculate the key within theExecutionContext
. Required ifsaveState(boolean)
is set to true.- Parameters:
name
- name of the reader instance- Returns:
- The current instance of the builder.
- See Also:
-
maxItemCount
Configure the max number of items to be read.- Parameters:
maxItemCount
- the max items to be read- Returns:
- The current instance of the builder.
- See Also:
-
currentItemCount
Index for the current item. Used on restarts to indicate where to start from.- Parameters:
currentItemCount
- current index- Returns:
- this instance for method chaining
- See Also:
-
parameterValues
A map of parameter values to be set on the query. The key of the map is the name of the parameter to be set with the value being the value to be set.- Parameters:
parameterValues
- map of values- Returns:
- this instance for method chaining
- See Also:
-
queryProvider
A query provider. This should be set only ifqueryString(String)
have not been set.- Parameters:
queryProvider
- the query provider- Returns:
- this instance for method chaining
- See Also:
-
queryString
The JPQL query string to execute. This should only be set ifqueryProvider(JpaQueryProvider)
has not been set.- Parameters:
queryString
- the JPQL query- Returns:
- this instance for method chaining
- See Also:
-
entityManagerFactory
public JpaCursorItemReaderBuilder<T> entityManagerFactory(jakarta.persistence.EntityManagerFactory entityManagerFactory) TheEntityManagerFactory
to be used for executing the configuredqueryString
.- Parameters:
entityManagerFactory
-EntityManagerFactory
used to createEntityManager
- Returns:
- this instance for method chaining
-
build
Returns a fully constructedJpaCursorItemReader
.- Returns:
- a new
JpaCursorItemReader
-