Announcement Announcement Module
No announcement yet.
validation error details to a database Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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


  • #2
    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?


    • #3
      m4.. I will try to do tests on m5 tomorrow.


      • #4
        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.


        • #5
          please, can you provide an example step that uses ItemReadListener to catch exceptions ?