May 31st, 2012, 08:24 AM
Read an process complete file before write in database
I'm new in Spring Framework and i am developing a Batch process where i must read a file (each line is mapped to an Entity Bean), process each line to find errors and persist it on database if no errors found.
I have been able to read a single line file (FlatFileItemReader), process it, and write in database (JpaItemWriter) with a Chunck-Oriented Step. The problem is that i must read all lines in the file, process them and persist the generated Entities in database if all them are correct.
I have tried with 3 steps but not succesfully. Is there a way to do this with a chunk? Any idea?
Thanks for your help and excuse my english
May 31st, 2012, 11:27 AM
OK, setting commit-interval a high value reads and process all lines before writing to database. This value seems to indicate the size of the chunk (items procesed), not the number of records inserted before a commit in database.