Jun 5th, 2008, 03:49 AM
Iterating again on a second request for each item with JdbcCursorItemReader
I need to use a JdbcCursorItemReader, and for each red item, call a second SQL request and iterate again. (knowing that using a single request with join would be a waste because of redundancy of data. Also we don't have time to work on SQL optimization).
So how would be the best way to implement it ? For exemple is it possible to start a subStep with JdbcCursorItemReader for each item red by the root JdsbcCursorItemReader ? Elseway ?
Jun 5th, 2008, 05:44 AM
Starting a sub-step for each item should work, although I'm not aware of anybody actually trying this. You'll probably want to use repository with map daos for the sub-steps and clear the repository after each sub-step.
Jun 5th, 2008, 01:29 PM
That's a pretty common pattern that I have seen used at many clients. You have an ItemReader that contains the JdbcCursorItemReader and another Dao. The JCIR would return some kind of object, then you would use data from there to call the dao for additional data. It's generally preferable to try and get it all at once with the JCIR, but I know there's cases where that isn't feasible.