spring-batch icon indicating copy to clipboard operation
spring-batch copied to clipboard

JpaPagingItemReader shouldn't do any write(flushing) [BATCH-1880]

Open spring-projects-issues opened this issue 13 years ago • 3 comments
trafficstars

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

spring-projects-issues avatar Jul 26 '12 18:07 spring-projects-issues

Davi Alves commented

Maybe I'm missing something here.

spring-projects-issues avatar Jul 26 '12 19:07 spring-projects-issues

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?

spring-projects-issues avatar Jul 27 '12 05:07 spring-projects-issues

Thank you for raising this issue. This issue will soon be closed unless the requested feedback is provided.

cppwfs avatar Jul 17 '23 13:07 cppwfs