public class HibernateItemReaderHelper<T> extends Object implements org.springframework.beans.factory.InitializingBean
Constructor and Description |
---|
HibernateItemReaderHelper() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
void |
clear()
Clear the session if stateful.
|
void |
close()
Close the open session (stateful or otherwise).
|
org.hibernate.Query |
createQuery()
Open appropriate type of hibernate session and create the query.
|
org.hibernate.ScrollableResults |
getForwardOnlyCursor(int fetchSize,
Map<String,Object> parameterValues)
Get a cursor over all of the results, with the forward-only flag set.
|
void |
jumpToItem(org.hibernate.ScrollableResults cursor,
int itemIndex,
int flushInterval)
Scroll through the results up to the item specified.
|
Collection<? extends T> |
readPage(int page,
int pageSize,
int fetchSize,
Map<String,Object> parameterValues)
Read a page of data, clearing the existing session (if necessary) first,
and creating a new session before executing the query.
|
void |
setQueryName(String queryName) |
void |
setQueryProvider(HibernateQueryProvider queryProvider) |
void |
setQueryString(String queryString) |
void |
setSessionFactory(org.hibernate.SessionFactory sessionFactory) |
void |
setUseStatelessSession(boolean useStatelessSession)
Can be set only in uninitialized state.
|
public void setQueryName(String queryName)
queryName
- name of a hibernate named querypublic void setQueryString(String queryString)
queryString
- HQL query stringpublic void setQueryProvider(HibernateQueryProvider queryProvider)
queryProvider
- Hibernate query providerpublic void setUseStatelessSession(boolean useStatelessSession)
useStatelessSession
- true
to use
StatelessSession
false
to use standard hibernate
Session
public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
sessionFactory
- hibernate session factorypublic void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
public org.hibernate.ScrollableResults getForwardOnlyCursor(int fetchSize, Map<String,Object> parameterValues)
fetchSize
- the fetch size to use retrieving the resultsparameterValues
- the parameter values to use (or null if none).ScrollableResults
public org.hibernate.Query createQuery()
public void jumpToItem(org.hibernate.ScrollableResults cursor, int itemIndex, int flushInterval)
cursor
- the results to scroll overpublic void close()
public Collection<? extends T> readPage(int page, int pageSize, int fetchSize, Map<String,Object> parameterValues)
page
- the page to read (starting at 0)pageSize
- the size of the page or maximum number of items to readfetchSize
- the fetch size to useparameterValues
- the parameter values to use (if any, otherwise
null)public void clear()
Copyright © 2014 Pivotal. All rights reserved.