Results 1 to 2 of 2

Thread: SqlServerMaxValueIncrementer getNextKey method and the delete statement

Hybrid View

  1. #1

    Default SqlServerMaxValueIncrementer getNextKey method and the delete statement

    Why does the SqlServerMaxValueIncrementer.getNextKey method perform a delete SQL statement? Does it serve any purpose for SQLServer?

    Specifically the following line of code (org.springframework/spring-jdbc/3.1.1.RELEASE, line 105):

    stmt.executeUpdate("delete from " + getIncrementerName() + " where " + getColumnName() + " < " + maxValue);

    As far as I can tell, the getNextKey method is performing the following:
    1. insert a row into table so the identity column generates the next key value
    2. select identity column value from table
    3. Delete the rows from table except last row

    I ask this because I occasionally see SQLServer deadlocks caused by the delete SQL statement when multiple jobs are running (not launched at the same time but are accessing the BATCH_STEP_EXECUTION_SEQ table roughly at the same time).

  2. #2
    Join Date
    Sep 2008
    Location
    Chicagoland, IL
    Posts
    351

    Default

    This is really a Spring JDBC question and is unrelated to Batch. Copying the post over to the Container forum...
    Michael Minella
    Spring Batch Lead
    Author - Pro Spring Batch
    http://www.michaelminella.com
    Twitter: @MichaelMinella

Posting Permissions

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