From f100d35ccb0e0ddc98f79542268bae2ceef3a220 Mon Sep 17 00:00:00 2001 From: trisberg Date: Mon, 4 Aug 2008 12:25:40 +0000 Subject: [PATCH] BATCH-354: added note about persistence context cleared and entities being detached --- .../batch/item/database/JpaPagingItemReader.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JpaPagingItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JpaPagingItemReader.java index 87cf6f5f0..012145c85 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JpaPagingItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JpaPagingItemReader.java @@ -47,6 +47,10 @@ import org.springframework.util.ClassUtils; * Setting a fairly large page size and using a commit interval that matches the page size should provide * better performance. * + * In order to reduce the memory usage for large results the persistence context is flushed and cleared + * after each page is read. This cuases any entities read to be detached. If you make changes to the + * entities and want the changes persisted then you must explicitly merge the entities. + * * The reader must be configured with an {@link javax.persistence.EntityManagerFactory} that is capable * of participating in Spring managed transactions. *