Announcement Announcement Module
Collapse
No announcement yet.
How to use Spring 3.x JdbcTemplate with NO transaction? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use Spring 3.x JdbcTemplate with NO transaction?

    Hi all,

    I need to invoke some sql and it needs to be done outside a transaction. It's being done on a separate thread in a noncritical listener after the db work in my main thread commits.

    I'm trying to use a new JdbcTemplate in the child thread, giving its constructor the DataSource that I'm using in my main thread, but there appears to be no way to turn autocommit back on via the new JdbcTemplate I'm using in the child thread. I don't see any properties allowing me to do that.

    How can I invoke arbitrary SQL via JdbcTemplate and have it do the work outside a transaction?

    Thanks,
    Matthew

  • #2
    I think my requirements would be met
    1. if I could either provide my own connection to the JdbcTemplate, for example, in the constructor,
    2. if there were a property or set of properties that I could set that instructed the JdbcTemplate to obtain a new connection from its DataSource, turn off autocommit and/or not enlist the work in a transaction, or
    3. if there were another framework class like JdbcTemplate but that didn't do any transaction management but provided the same convenient methods as JdbcTemplate.
    Make sense?

    Comment


    • #3
      Uh, great. So if I download pirated DVDs, I can use JdbcTemplate with no transaction? Wow, I would have never guessed.

      Comment

      Working...
      X