Results 1 to 3 of 3

Thread: Iterating again on a second request for each item with JdbcCursorItemReader

  1. #1

    Default Iterating again on a second request for each item with JdbcCursorItemReader

    Hello,

    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 ?

    best regards

  2. #2

    Default

    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.

  3. #3
    Join Date
    Dec 2006
    Posts
    1,061

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •