Class HibernateCursorItemReader<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.HibernateCursorItemReader<T>
- All Implemented Interfaces:
ItemReader<T>,ItemStream,ItemStreamReader<T>,org.springframework.beans.factory.InitializingBean
@Deprecated(since="5.0",
forRemoval=true)
public class HibernateCursorItemReader<T>
extends AbstractItemCountingItemStreamItemReader<T>
implements org.springframework.beans.factory.InitializingBean
Deprecated, for removal: This API element is subject to removal in a future version.
ItemStreamReader for reading database records built on top of Hibernate. It
executes the HQL query when initialized iterates over the result set as AbstractItemCountingItemStreamItemReader.read()
method is called, returning an object corresponding to current row. 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 update(ExecutionContext) method
without being flushed (no data modifications are expected).
- Author:
- Robert Kasanicky, Dave Syer, Mahmoud Ben Hassine
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated, for removal: This API element is subject to removal in a future version.protected voiddoClose()Deprecated, for removal: This API element is subject to removal in a future version.Close the cursor and hibernate session.protected voiddoOpen()Deprecated, for removal: This API element is subject to removal in a future version.Open hibernate session and create a forward-only cursor for the query.protected TdoRead()Deprecated, for removal: This API element is subject to removal in a future version.Read next item from input.protected voidjumpToItem(int itemIndex) Deprecated, for removal: This API element is subject to removal in a future version.Wind forward through the result set to the item requested.voidsetFetchSize(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.voidsetParameterValues(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).voidsetQueryName(String queryName) Deprecated, for removal: This API element is subject to removal in a future version.A query name for an externalized query.voidsetQueryProvider(HibernateQueryProvider<T> queryProvider) Deprecated, for removal: This API element is subject to removal in a future version.A query provider.voidsetQueryString(String queryString) Deprecated, for removal: This API element is subject to removal in a future version.A query string in HQL.voidsetSessionFactory(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.voidsetUseStatelessSession(boolean useStatelessSession) Deprecated, for removal: This API element is subject to removal in a future version.Can be set only in uninitialized state.voidupdate(ExecutionContext executionContext) Deprecated, for removal: This API element is subject to removal in a future version.Update the context and clear the session if stateful.Methods inherited from class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader
close, getCurrentItemCount, isSaveState, open, read, setCurrentItemCount, setMaxItemCount, setSaveStateMethods inherited from class org.springframework.batch.item.ItemStreamSupport
getExecutionContextKey, getName, setExecutionContextName, setName
-
Constructor Details
-
HibernateCursorItemReader
public HibernateCursorItemReader()Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
afterPropertiesSet
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
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 stringor the {query providershould 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 stringor the {query nameshould 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 provideror the {query nameshould 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- theSessionFactoryto 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-trueto useStatelessSessionfalseto use standard hibernateSession
-
doRead
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:AbstractItemCountingItemStreamItemReaderRead next item from input.- Specified by:
doReadin classAbstractItemCountingItemStreamItemReader<T>- Returns:
- an item or
nullif the data source is exhausted - Throws:
Exception- Allows subclasses to throw checked exceptions for interpretation by the framework
-
doOpen
Deprecated, for removal: This API element is subject to removal in a future version.Open hibernate session and create a forward-only cursor for the query.- Specified by:
doOpenin classAbstractItemCountingItemStreamItemReader<T>- Throws:
Exception- Allows subclasses to throw checked exceptions for interpretation by the framework
-
update
Deprecated, for removal: This API element is subject to removal in a future version.Update the context and clear the session if stateful.- Specified by:
updatein interfaceItemStream- Overrides:
updatein classAbstractItemCountingItemStreamItemReader<T>- Parameters:
executionContext- the currentExecutionContext- Throws:
ItemStreamException- if there is a problem- See Also:
-
jumpToItem
Deprecated, for removal: This API element is subject to removal in a future version.Wind forward through the result set to the item requested. Also clears the session every now and then (if stateful) to avoid memory problems. The frequency of session clearing is the larger of the fetch size (if set) and 100.- Overrides:
jumpToItemin classAbstractItemCountingItemStreamItemReader<T>- Parameters:
itemIndex- the first item to read- Throws:
Exception- if there is a problem- See Also:
-
doClose
Deprecated, for removal: This API element is subject to removal in a future version.Close the cursor and hibernate session.- Specified by:
doClosein classAbstractItemCountingItemStreamItemReader<T>- Throws:
Exception- Allows subclasses to throw checked exceptions for interpretation by the framework
-
JpaCursorItemReaderinstead.