class HibernatePagingItemReader<T> extends AbstractPagingItemReader<T> implements InitializingBean {

	private final HibernateItemReaderHelper<T> helper = new HibernateItemReaderHelper<>();

	private Map<String, Object> parameterValues;

	private int fetchSize;

	public HibernatePagingItemReader() {
		setName(ClassUtils.getShortName(HibernatePagingItemReader.class));
	}

	/**
	 * The parameter values to apply to a query (map of name:value).
	 * @param parameterValues the parameter values to set
	 */
	public void setParameterValues(Map<String, Object> parameterValues) {
		this.parameterValues = parameterValues;
	}

	/**
	 * A query name for an externalized query. Either this or the {
	 * {@link #setQueryString(String) query string} or the {
	 * {@link #setQueryProvider(HibernateQueryProvider) query provider} should be set.
	 * @param queryName name of a hibernate named query
	 */
	public void setQueryName(String queryName) {
		helper.setQueryName(queryName);
	}

	/**
	 * Fetch size used internally by Hibernate to limit amount of data fetched from
	 * database per round trip.
	 * @param fetchSize the fetch size to pass down to Hibernate
	 */
	public void setFetchSize(int fetchSize) {
		this.fetchSize = fetchSize;
	}

	/**
	 * A query provider. Either this or the {{@link #setQueryString(String) query string}
	 * or the {{@link #setQueryName(String) query name} should be set.
	 * @param queryProvider Hibernate query provider
	 */
	public void setQueryProvider(HibernateQueryProvider<? extends T> queryProvider) {
		helper.setQueryProvider(queryProvider);
	}

	/**
	 * A query string in HQL. Either this or the {
	 * {@link #setQueryProvider(HibernateQueryProvider) query provider} or the {
	 * {@link #setQueryName(String) query name} should be set.
	 * @param queryString HQL query string
	 */
	public void setQueryString(String queryString) {
		helper.setQueryString(queryString);
	}

	/**
	 * The Hibernate SessionFactory to use the create a session.
	 * @param sessionFactory the {@link SessionFactory} to set
	 */
	public void setSessionFactory(SessionFactory sessionFactory) {
		helper.setSessionFactory(sessionFactory);
	}

	/**
	 * Can be set only in uninitialized state.
	 * @param useStatelessSession <code>true</code> to use {@link StatelessSession}
	 * <code>false</code> to use standard hibernate {@link Session}
	 */
	public void setUseStatelessSession(boolean useStatelessSession) {
		helper.setUseStatelessSession(useStatelessSession);
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		super.afterPropertiesSet();
		Assert.state(fetchSize >= 0, "fetchSize must not be negative");
		helper.afterPropertiesSet();
	}

	@Override
	protected void doOpen() throws Exception {
		super.doOpen();
	}

	@Override
	protected void doReadPage() {<FILL_FUNCTION_BODY>}

	@Override
	protected void doClose() throws Exception {
		helper.close();
		super.doClose();
	}

}


		if (results == null) {
			results = new CopyOnWriteArrayList<>();
		}
		else {
			results.clear();
		}

		results.addAll(helper.readPage(getPage(), getPageSize(), fetchSize, parameterValues));

	
<methods>public void <init>() ,public void afterPropertiesSet() throws java.lang.Exception,public int getPage() ,public int getPageSize() ,public void setPageSize(int) <variables>private volatile int current,private volatile boolean initialized,private final java.util.concurrent.locks.Lock lock,protected org.apache.commons.logging.Log logger,private volatile int page,private int pageSize,protected volatile List<T> results