Example usage for org.springframework.batch.item.database JpaPagingItemReader setEntityManagerFactory

List of usage examples for org.springframework.batch.item.database JpaPagingItemReader setEntityManagerFactory

Introduction

In this page you can find the example usage for org.springframework.batch.item.database JpaPagingItemReader setEntityManagerFactory.

Prototype

public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) 

Source Link

Usage

From source file:org.springframework.batch.item.database.JpaPagingItemReaderAsyncTests.java

private JpaPagingItemReader<Foo> getItemReader() throws Exception {

    String jpqlQuery = "select f from Foo f";

    JpaPagingItemReader<Foo> reader = new JpaPagingItemReader<Foo>();
    reader.setQueryString(jpqlQuery);//www.  j  a  va 2s.  com
    reader.setEntityManagerFactory(entityManagerFactory);
    reader.setPageSize(PAGE_SIZE);
    reader.afterPropertiesSet();
    reader.setSaveState(false);
    reader.open(new ExecutionContext());

    return reader;
}