Results 1 to 3 of 3

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

  1. #1
    Join Date
    Jul 2005
    Location
    Austin, TX
    Posts
    137

    Default 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. #2
    Join Date
    Jul 2005
    Location
    Austin, TX
    Posts
    137

    Default

    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?

  3. #3
    Join Date
    Jul 2005
    Location
    Austin, TX
    Posts
    137

    Default

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

Posting Permissions

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