Results 1 to 2 of 2

Thread: Spring JdbcTemplate - Update not happening

  1. #1
    Join Date
    Oct 2012
    Posts
    1

    Question Spring JdbcTemplate - Update not happening

    Hi,

    In our application, we are using Spring with Jdbctemplate for database operations.In a particular table, Insert is happening in a seperate thread and update is happening in a seperate thread. Insert query has been executed and the transaction is available in database. But update is not happening for the record that is inserted. Number of updated rows are returning as zero and there are no exceptions in both the application and database logs. This issue occurs occasionally and not for every transaction. We are using JdbcTemplate and JTATransactionManager. Our code is deployed in Weblogic application server.

    We have tried with JdbcDaoSupport class instead of JdbcTemplate and used PreparedStatement to set the values instead of passing Object Arrays. But none resolves the issue. We suspected that the insert has not been committed properly but before that update is happening and hence the number of records updated is returning as zero. Hence we tried by updating the transactionality from REQUIRED to REQUIRES_NEW. But still some of the records are not getting updated. Any suggesstions to resolve the issue are welcome.

  2. #2
    Join Date
    Jan 2009
    Location
    Huntington Beach, CA
    Posts
    718

    Default

    Well, my first guess is that since they happen in two different threads concurrently, that maybe the update is being executed before the insert. So therefore there is no record inserted yet to update.

    Mark

Posting Permissions

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