spring-batch
spring-batch copied to clipboard
JpaPagingItemReader shouldn't do any write(flushing) [BATCH-1880]
Davi Alves opened BATCH-1880 and commented
Taking a look at the JpaPagingItemReader source code and it Javadoc: If you make changes to the entities and want the changes persisted then you must explicitly merge the entities.
But doesn't this go against the framework idea? The reader shouldn't do any write, only a clear should be enough. Otherwise will happen like here: http://forum.springsource.org/showthread.php?128667-Problem-with-JpaPagingItemReader-and-pageSize&p=420261#post420261 Flush in the Writer and in the Reader.
Affects: 2.1.8
Reference URL: http://forum.springsource.org/showthread.php?128667-Problem-with-JpaPagingItemReader-and-pageSize
Dave Syer commented
I agree that the flush() in JpaPagingItemReader might be a mistake, but it would be harmless if you follow best practice advice (as per the forum thread) and merge and flush explicitly in the writer, or simply don't use JPA for reading. Can you provide a simple test case that proves it one way or the other?
Thank you for raising this issue. This issue will soon be closed unless the requested feedback is provided.