|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.batch.item.database.HibernateItemReaderHelper<T>
public class HibernateItemReaderHelper<T>
Internal shared state helper for hibernate readers managing sessions and queries.
Constructor Summary | |
---|---|
HibernateItemReaderHelper()
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HibernateItemReaderHelper()
Method Detail |
---|
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 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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |