Mar 5th, 2008, 08:52 AM
validation error details to a database
I am trying to use spring batch but the documentation is terrible.
What I need to do is to validate a fixed length input file completelly and write errors to a database (error description, line of the input where occurred).
I don't need to write the input data to the database now. What I need to do is generate an error report to be sent to our customers so they can resend us the input file corrected.
I saw already that I can use exceptionHandler so I can process the whole file skipping the errors. That is working fine. The problem now is how to determine where these errors occurred (which line and the error detail) and where and how to write them to the database.
any code example would be of much help
Mar 5th, 2008, 03:01 PM
Apologies on the incomplete documentation, I actually took a break from working on them to check the forums. Which version of the framework are you using? M5?
Mar 5th, 2008, 03:55 PM
m4.. I will try to do tests on m5 tomorrow.
Mar 5th, 2008, 09:12 PM
M5 should make things a little easier to understand, since you can use an ItemReadListener to catch exceptions, which is bit more explicit than using the ExceptionHandler. The FlatFileItemReader throws a FlatFileParsingException, from which you can get the original line of input.
Mar 7th, 2008, 09:35 AM
please, can you provide an example step that uses ItemReadListener to catch exceptions ?