Announcement Announcement Module
No announcement yet.
Spring JdbcTemplate - Update not happening Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring JdbcTemplate - Update not happening


    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
    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.