Results 1 to 2 of 2
  1. #1
    penguin123 is offline Member
    Join Date
    Aug 2013
    Rep Power

    Question does NamedParameterJdbcTemplate.update wait until mysql transaction finishes?

    Ok, I've probably dug up the entire Google land and still couldn't find anything that could possibly answer my question.

    I have my little foo method that does some deleting like this:

    Java Code:
    private void foo()
       jdbcNamedParameterTemplate.update(sqlString, params);   //1
       jdbcNamedParameterTemplate.update(sqlString2, params2); //2
    sqlString and sqlString2 are just delete statements like "Delete * from FooBar". So when I get to the second call to update, do I have any guarantee that whatever operation the first one invokes in the database has already finished?

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Rep Power

    Default Re: does NamedParameterJdbcTemplate.update wait until mysql transaction finishes?

    Well since you posted this in the Hibernate forum and not in the Spring forum, I'd guess you have been looking in all the wrong places.

    Simple logic. Go to the API documentation:


    The API documentation says nothing about performing the operation threaded, so it is going to end when the database operation ends. What you do NOT have a guarantee of is that the update will already be either committed or at least flushed to the database, then you'd have to read the Spring documentation on how the database transaction management works. Judging from the API documentation this class is a simple wrapper around JDBC, so whatever is true for JDBC and the database driver you're using is also true for this class.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Replies: 1
    Last Post: 08-28-2012, 07:52 AM
  2. Java/MySQL UPDATE.........Help Please
    By Lamita Nera in forum JDBC
    Replies: 4
    Last Post: 06-10-2011, 10:13 PM
  3. update arraylist to mysql database
    By sks in forum JDBC
    Replies: 11
    Last Post: 04-01-2011, 09:26 AM
  4. Mysql/JDBC update query problem
    By thelinuxguy in forum Advanced Java
    Replies: 3
    Last Post: 02-11-2009, 10:56 PM
  5. unable to update MYSQL with values from jsp page
    By koushika in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 03-27-2008, 02:35 AM

Tags for this Thread

Posting Permissions

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