In Spring-batch, normally when we used any itemreader it will fetch each row with every call of read method and once its equal to commit interval , it sends data to writer.
I have read that StoredProcedureItemReader and JdbcCursorItemReader is cursor based reader , once queries are executed data is in curser and read method gets on row in each call.
However, my question is where this cursor resides in java memory or database as :- 1. If its fetching all the data in java memory in single go, then what is advantage of having batch, as application will have chances of getting slow or get out of memory. 2. If it is somewhere in database, then Storeprocedor or JDBC connection itself will time, till the all records are fetched in process.
I tried to find answer but didn't find anywhere in documentation and also don't know to test this to know for sure by myself. I seems important to me, as if some as to use these readers, they will need to increase the timeout for connection or they need have more heap memory.