Announcement Announcement Module
No announcement yet.
Spring and long running JDBC operations Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring and long running JDBC operations

    We're implementing a use case where a clients need to iterate over an open JDBC cursor (possibly in several requests).
    I'm trying to find a way to do this using the spring JDBC classes (JdbcTemplate), but the catch is that for the iteration to work the ResultSet, PreparedStatement and Connection must remain open, while the whole idea of JdbcTemplate is to close it for you.
    I googled around for a bit but didn't find a solution. Am I missing a neat configuration option for this?

    The only solution I can think of, is to create dynamic proxies wrapping Connection, PreparedStatement and ResultSet that ignore close() calls, and binding the connection to the thead+DataSource using the TransactionSynchronizationManager. I've done this and it works, but it's a bit complex...