AbstractGenericDataSourceItemReaderIntegrationTests {
@Override
protected ItemReader<Foo> createItemReader() throws Exception {
LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
factoryBean.setDataSource(dataSource);
factoryBean.setMappingLocations(new Resource[] { new ClassPathResource("Foo.hbm.xml", getClass()) });
customizeSessionFactory(factoryBean);
factoryBean.afterPropertiesSet();
SessionFactory sessionFactory = factoryBean.getObject();
HibernatePagingItemReader<Foo> hibernateReader = new HibernatePagingItemReader<Foo>();
setQuery(hibernateReader);
hibernateReader.setPageSize(2);
hibernateReader.setSessionFactory(sessionFactory);