Announcement Announcement Module
No announcement yet.
Multiple Update Statements in One DB call using Spring JDBC Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple Update Statements in One DB call using Spring JDBC

    Hi All,

    I am using Spring JDBC (JDBCTemplate and its variations) in my project. I have a situation wherein business layer is sending me an Object Graph which I have to persist in 3 separate tables in DB. I want to achieve this in one DB call. How can I do this.

    I am using Spring 3.1.1.RELEASE

    Thanks in advance,

  • #2
    I suspect you want not one db call but one transaction...

    Simply define the service method which calls the different dao methods or dao method as transactional. I suggest a read of the tx chapter of the reference guide.


    • #3
      Hi Marten,

      Thanks for the reply.

      I am aware of the transaction aspect; and as a general practice, I am planning to take similar approach (as you have suggested). But I was just checking if Spring has some capability to provide such a functionality.

      There is another approach which can suffice my requirement; that is PL/SQL way of doing it. Do you see any concerns/anti-pattern sort of this with PL/SQL approach?