类 HibernateCursorItemReaderBuilder<T>
- java.lang.Object
- org.springframework.batch.item.database.builder.HibernateCursorItemReaderBuilder<T>
public class HibernateCursorItemReaderBuilder<T> extends java.lang.Object
This is a builder for theHibernateCursorItemReader
. When configuring, one of the following should be provided (listed in order of precedence):- 从以下版本开始:
- 4.0
- 作者:
- Michael Minella, Glenn Renfro
- 另请参阅:
HibernateCursorItemReader
构造器概要
构造器 构造器 说明 HibernateCursorItemReaderBuilder()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 HibernateCursorItemReader<T>
build()
Returns a fully constructedHibernateCursorItemReader
.HibernateCursorItemReaderBuilder<T>
currentItemCount(int currentItemCount)
Index for the current item.HibernateCursorItemReaderBuilder<T>
entityClass(java.lang.Class nativeClass)
HibernateCursorItemReaderBuilder<T>
fetchSize(int fetchSize)
The number of items to be returned with each round trip to the database.HibernateCursorItemReaderBuilder<T>
maxItemCount(int maxItemCount)
Configure the max number of items to be read.HibernateCursorItemReaderBuilder<T>
name(java.lang.String name)
The name used to calculate the key within theExecutionContext
.HibernateCursorItemReaderBuilder<T>
nativeQuery(java.lang.String nativeQuery)
Used to configure aHibernateNativeQueryProvider
.HibernateCursorItemReaderBuilder<T>
parameterValues(java.util.Map<java.lang.String,java.lang.Object> parameterValues)
A map of parameter values to be set on the query.HibernateCursorItemReaderBuilder<T>
queryName(java.lang.String queryName)
The name of the Hibernate named query to be executed for this reader.HibernateCursorItemReaderBuilder<T>
queryProvider(HibernateQueryProvider<T> queryProvider)
A query provider.HibernateCursorItemReaderBuilder<T>
queryString(java.lang.String queryString)
The HQL query string to execute.HibernateCursorItemReaderBuilder<T>
saveState(boolean saveState)
Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.HibernateCursorItemReaderBuilder<T>
sessionFactory(org.hibernate.SessionFactory sessionFactory)
The HibernateSessionFactory
to execute the query against.HibernateCursorItemReaderBuilder<T>
useStatelessSession(boolean useStatelessSession)
Indicator for whether to use aStatelessSession
(true
) or aSession
(false
).
构造器详细资料
HibernateCursorItemReaderBuilder
public HibernateCursorItemReaderBuilder()
方法详细资料
saveState
public HibernateCursorItemReaderBuilder<T> saveState(boolean saveState)
Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.- 参数:
saveState
- defaults to true- 返回:
- The current instance of the builder.
name
public HibernateCursorItemReaderBuilder<T> name(java.lang.String name)
The name used to calculate the key within theExecutionContext
. Required ifsaveState(boolean)
is set to true.- 参数:
name
- name of the reader instance- 返回:
- The current instance of the builder.
- 另请参阅:
ItemStreamSupport.setName(String)
maxItemCount
public HibernateCursorItemReaderBuilder<T> maxItemCount(int maxItemCount)
Configure the max number of items to be read.- 参数:
maxItemCount
- the max items to be read- 返回:
- The current instance of the builder.
- 另请参阅:
AbstractItemCountingItemStreamItemReader.setMaxItemCount(int)
currentItemCount
public HibernateCursorItemReaderBuilder<T> currentItemCount(int currentItemCount)
Index for the current item. Used on restarts to indicate where to start from.- 参数:
currentItemCount
- current index- 返回:
- this instance for method chaining
- 另请参阅:
AbstractItemCountingItemStreamItemReader.setCurrentItemCount(int)
parameterValues
public HibernateCursorItemReaderBuilder<T> parameterValues(java.util.Map<java.lang.String,java.lang.Object> 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.- 参数:
parameterValues
- map of values- 返回:
- this instance for method chaining
- 另请参阅:
HibernateCursorItemReader.setParameterValues(Map)
queryName
public HibernateCursorItemReaderBuilder<T> queryName(java.lang.String queryName)
The name of the Hibernate named query to be executed for this reader.- 参数:
queryName
- name of the query to execute- 返回:
- this instance for method chaining
- 另请参阅:
HibernateCursorItemReader.setQueryName(String)
fetchSize
public HibernateCursorItemReaderBuilder<T> fetchSize(int fetchSize)
The number of items to be returned with each round trip to the database. Used internally by Hibernate.- 参数:
fetchSize
- number of records to return per fetch- 返回:
- this instance for method chaining
- 另请参阅:
HibernateCursorItemReader.setFetchSize(int)
queryProvider
public HibernateCursorItemReaderBuilder<T> queryProvider(HibernateQueryProvider<T> queryProvider)
A query provider. This should be set only ifqueryString(String)
andqueryName(String)
have not been set.- 参数:
queryProvider
- the query provider- 返回:
- this instance for method chaining
- 另请参阅:
HibernateCursorItemReader.setQueryProvider(HibernateQueryProvider)
queryString
public HibernateCursorItemReaderBuilder<T> queryString(java.lang.String queryString)
The HQL query string to execute. This should only be set ifqueryProvider(HibernateQueryProvider)
andqueryName(String)
have not been set.- 参数:
queryString
- the HQL query- 返回:
- this instance for method chaining
- 另请参阅:
HibernateCursorItemReader.setQueryString(String)
sessionFactory
public HibernateCursorItemReaderBuilder<T> sessionFactory(org.hibernate.SessionFactory sessionFactory)
The HibernateSessionFactory
to execute the query against.- 参数:
sessionFactory
- the session factory- 返回:
- this instance for method chaining
- 另请参阅:
HibernateCursorItemReader.setSessionFactory(SessionFactory)
useStatelessSession
public HibernateCursorItemReaderBuilder<T> useStatelessSession(boolean useStatelessSession)
Indicator for whether to use aStatelessSession
(true
) or aSession
(false
).- 参数:
useStatelessSession
- Defaults to false- 返回:
- this instance for method chaining
- 另请参阅:
HibernateCursorItemReader.setUseStatelessSession(boolean)
nativeQuery
public HibernateCursorItemReaderBuilder<T> nativeQuery(java.lang.String nativeQuery)
Used to configure aHibernateNativeQueryProvider
. This is ignored if- 参数:
nativeQuery
-String
containing the native query.- 返回:
- this instance for method chaining
entityClass
public HibernateCursorItemReaderBuilder<T> entityClass(java.lang.Class nativeClass)
build
public HibernateCursorItemReader<T> build()
Returns a fully constructedHibernateCursorItemReader
.- 返回:
- a new
HibernateCursorItemReader