Announcement Announcement Module
Collapse
No announcement yet.
Correctly loop through multiple ResultSets in a simple query. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Correctly loop through multiple ResultSets in a simple query.

    I'm working with a horrible database that requires us to bunch together all of our select queries and then iterate through the result sets to construct objects out of them. However this odd case isn't easily supported by the jdbc template which means I have to get my hands dirty with some old fashioned jdbc code, but I've been spoiled so long by spring that I can't figure out the correct way to do it.

    My code is using the doInPreparedStatement(PreparedStatement ps) callback. Here I need to iterate through multiple result sets, and then parse each of them separately. According to the spring docs, these result sets need to be closed manually. Does anyone have any boilerplate code lying around to do this correctly? Is there a simpler way with the jdbc template to accomplish this? Note that I won't know how many result sets are coming back.

    Thanks
Working...
X