Jul 9th, 2010, 09:34 AM
Creating JobParameters during a Job?
We are writing a program in spring batch with 2 processes; one to refresh all 4 tables with data parsed from XML and the other to update the tables, deleting them if necessary and inserting new data.
So far we can programmed a refresh, we managed to create the SQL parameters for the the job: the date, the table and the SQL query(which will just be an insert all the time because the tables will be truncated before completely rewritten.)
The second process is a bit of a problem, the XML when requesting updates from a certain date, has another tag included regarding whether the data for the row was updated or deleted, now as I have to read the XML to figure out
whther it is a delete or insert statement I need I cant pass them as JobParamters to the job.
How can I create the query depending on whether an update or delete query and pass it to the writer on the fly as it were.
Any Advice is much appreciated
Jul 10th, 2010, 03:06 AM
If I understand correctly it seems the update takes place in a second step, so it doesn't make much sense to try and keep all the information you need for it in memory from the first step. Can't you store a flag in the database on the first pass (either in the records themselves or in a join table)? Or refactor into a single step?