Class HibernatePagingItemReader<T>
java.lang.Object
org.springframework.batch.item.ItemStreamSupport
org.springframework.batch.item.support.AbstractItemStreamItemReader<T>
org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>
org.springframework.batch.item.database.AbstractPagingItemReader<T>
org.springframework.batch.item.database.HibernatePagingItemReader<T>
- All Implemented Interfaces:
ItemReader<T>
,ItemStream
,ItemStreamReader<T>
,org.springframework.beans.factory.InitializingBean
@Deprecated(since="5.0",
forRemoval=true)
public class HibernatePagingItemReader<T>
extends AbstractPagingItemReader<T>
implements org.springframework.beans.factory.InitializingBean
Deprecated, for removal: This API element is subject to removal in a future version.
ItemReader
for reading database records built on top of Hibernate and reading
only up to a fixed number of items at a time. It executes an HQL query when initialized
is paged as the AbstractItemCountingItemStreamItemReader.read()
method is called. The query can be set directly using
setQueryString(String)
, a named query can be used by
setQueryName(String)
, or a query provider strategy can be supplied via
setQueryProvider(HibernateQueryProvider)
.
The reader can be configured to use either StatelessSession
sufficient for
simple mappings without the need to cascade to associated objects or standard hibernate
Session
for more advanced mappings or when caching is desired. When stateful
session is used it will be cleared in the AbstractItemCountingItemStreamItemReader.update(ExecutionContext)
method
without being flushed (no data modifications are expected).
The implementation is thread-safe in between calls to AbstractItemCountingItemStreamItemReader.open(ExecutionContext)
,
but remember to use saveState=false
if used in a multi-threaded client (no
restart available).
- Since:
- 2.1
- Author:
- Dave Syer, Mahmoud Ben Hassine
-
Field Summary
Fields inherited from class org.springframework.batch.item.database.AbstractPagingItemReader
logger, results
-
Constructor Summary
ConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Deprecated, for removal: This API element is subject to removal in a future version.Check mandatory properties.protected void
doClose()
Deprecated, for removal: This API element is subject to removal in a future version.Close the resources opened inAbstractItemCountingItemStreamItemReader.doOpen()
.protected void
doOpen()
Deprecated, for removal: This API element is subject to removal in a future version.Open resources necessary to start reading input.protected void
Deprecated, for removal: This API element is subject to removal in a future version.void
setFetchSize
(int fetchSize) Deprecated, for removal: This API element is subject to removal in a future version.Fetch size used internally by Hibernate to limit amount of data fetched from database per round trip.void
setParameterValues
(Map<String, Object> parameterValues) Deprecated, for removal: This API element is subject to removal in a future version.The parameter values to apply to a query (map of name:value).void
setQueryName
(String queryName) Deprecated, for removal: This API element is subject to removal in a future version.A query name for an externalized query.void
setQueryProvider
(HibernateQueryProvider<? extends T> queryProvider) Deprecated, for removal: This API element is subject to removal in a future version.A query provider.void
setQueryString
(String queryString) Deprecated, for removal: This API element is subject to removal in a future version.A query string in HQL.void
setSessionFactory
(org.hibernate.SessionFactory sessionFactory) Deprecated, for removal: This API element is subject to removal in a future version.The Hibernate SessionFactory to use the create a session.void
setUseStatelessSession
(boolean useStatelessSession) Deprecated, for removal: This API element is subject to removal in a future version.Can be set only in uninitialized state.Methods inherited from class org.springframework.batch.item.database.AbstractPagingItemReader
doRead, getPage, getPageSize, jumpToItem, setPageSize
Methods inherited from class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader
close, getCurrentItemCount, isSaveState, open, read, setCurrentItemCount, setMaxItemCount, setSaveState, update
Methods inherited from class org.springframework.batch.item.ItemStreamSupport
getExecutionContextKey, getName, setExecutionContextName, setName
-
Constructor Details
-
HibernatePagingItemReader
public HibernatePagingItemReader()Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
setParameterValues
Deprecated, for removal: This API element is subject to removal in a future version.The parameter values to apply to a query (map of name:value).- Parameters:
parameterValues
- the parameter values to set
-
setQueryName
Deprecated, for removal: This API element is subject to removal in a future version.A query name for an externalized query. Either this or the {query string
or the {query provider
should be set.- Parameters:
queryName
- name of a hibernate named query
-
setFetchSize
public void setFetchSize(int fetchSize) Deprecated, for removal: This API element is subject to removal in a future version.Fetch size used internally by Hibernate to limit amount of data fetched from database per round trip.- Parameters:
fetchSize
- the fetch size to pass down to Hibernate
-
setQueryProvider
Deprecated, for removal: This API element is subject to removal in a future version.A query provider. Either this or the {query string
or the {query name
should be set.- Parameters:
queryProvider
- Hibernate query provider
-
setQueryString
Deprecated, for removal: This API element is subject to removal in a future version.A query string in HQL. Either this or the {query provider
or the {query name
should be set.- Parameters:
queryString
- HQL query string
-
setSessionFactory
public void setSessionFactory(org.hibernate.SessionFactory sessionFactory) Deprecated, for removal: This API element is subject to removal in a future version.The Hibernate SessionFactory to use the create a session.- Parameters:
sessionFactory
- theSessionFactory
to set
-
setUseStatelessSession
public void setUseStatelessSession(boolean useStatelessSession) Deprecated, for removal: This API element is subject to removal in a future version.Can be set only in uninitialized state.- Parameters:
useStatelessSession
-true
to useStatelessSession
false
to use standard hibernateSession
-
afterPropertiesSet
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:AbstractPagingItemReader
Check mandatory properties.- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Overrides:
afterPropertiesSet
in classAbstractPagingItemReader<T>
- Throws:
Exception
- See Also:
-
InitializingBean.afterPropertiesSet()
-
doOpen
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:AbstractItemCountingItemStreamItemReader
Open resources necessary to start reading input.- Overrides:
doOpen
in classAbstractPagingItemReader<T>
- Throws:
Exception
- Allows subclasses to throw checked exceptions for interpretation by the framework
-
doReadPage
protected void doReadPage()Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
doReadPage
in classAbstractPagingItemReader<T>
-
doClose
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:AbstractItemCountingItemStreamItemReader
Close the resources opened inAbstractItemCountingItemStreamItemReader.doOpen()
.- Overrides:
doClose
in classAbstractPagingItemReader<T>
- Throws:
Exception
- Allows subclasses to throw checked exceptions for interpretation by the framework
-
JpaPagingItemReader
instead.