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);