Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class JpaItemWriter<T> implements ItemWriter<T> {

protected static final Log logger = LogFactory.getLog(JpaItemWriter.class);

private EntityManagerFactory entityManagerFactory;
private final EntityManagerFactory entityManagerFactory;

private boolean usePersist = false;

Expand All @@ -65,14 +65,6 @@ public JpaItemWriter(EntityManagerFactory entityManagerFactory) {
this.entityManagerFactory = entityManagerFactory;
}

/**
* Set the EntityManager to be used internally.
* @param entityManagerFactory the entityManagerFactory to set
*/
public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) {
this.entityManagerFactory = entityManagerFactory;
}

/**
* Set whether the EntityManager should perform a persist instead of a merge.
* @param usePersist whether to use persist instead of merge.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
*/
public class JpaPagingItemReader<T> extends AbstractPagingItemReader<T> {

private EntityManagerFactory entityManagerFactory;
private final EntityManagerFactory entityManagerFactory;

private @Nullable EntityManager entityManager;

Expand All @@ -113,10 +113,6 @@ public JpaPagingItemReader(EntityManagerFactory entityManagerFactory) {
this.entityManagerFactory = entityManagerFactory;
}

public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) {
this.entityManagerFactory = entityManagerFactory;
}

/**
* The parameter values to be used for the query execution.
* @param parameterValues the values keyed by the parameter named used in the query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ protected AbstractPagingItemReader<Foo> getItemReader() throws Exception {
jpaNamedQueryProvider.setEntityClass(Foo.class);
jpaNamedQueryProvider.afterPropertiesSet();

reader.setEntityManagerFactory(entityManagerFactory);
reader.setQueryProvider(jpaNamedQueryProvider);
reader.afterPropertiesSet();
reader.setSaveState(true);
Expand Down