Jan 8th, 2008, 09:04 AM
SQL Cursor Input Source - clarifications
Just to clarify some issues regarding SQL Cursor input source.
A) Will the query get executed every time when the application starts up. What I am observing is that the tasklet that I configured which uses an input source as a SQL query, it executes the query when the application starts up. Is this correct ?
B) Suppose I add more rows to the table, the input source always seems to pick up the initial set of data that it initially queried ? The new rows dont seem to get picked up
I dont know if I have configured something wrong. Do let me know
Jan 8th, 2008, 02:59 PM
A: what do you mean by 'starts up'? The query is executed on the open() method of the item reader (aka input source). This usually happens lazily when the first record is read.
B: you aren't supposed to insert extra data between restarts. If a job fails then on a restart the cursor is positioned on the last row that was successfully processed. If you inserted data before that point it wouldn't be picked up on a restart (but you would have been doing something a bit odd to start with).
Jan 9th, 2008, 09:03 AM
A) What I meant was while loading the job definitions in the batch configuration files, during the application startup (we have a web application), the SQL query seems to get executed which tries to read data from the table. This is seperate from when we actually call the job explicitly.
Jan 9th, 2008, 11:26 AM
Is it possible that your JobLauncher is autostarting by default? This would explain why the job is running, and hence the query is being executed. As Dave said, the query isn't run until a call to read() is made on the ItemReader(input source).