Announcement Announcement Module
No announcement yet.
Transaction abort by JDBC driver? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Transaction abort by JDBC driver?

    I am experiencing a strange problem:

    I fired an optimistic insertion. The insert fails due a violation of a unique constraint. Since it fails, I wanted to throw an exception in the business layer and continue using a compensation operation.

    Saidly by executing the compensation operation (even on select), I was informed that the transaction is aborted and the operation is ignored. So I burried my head in the Spring sources but there was no transaction abort on any level (I use SqlOperation subclasses).

    So I guess the abortion is done by the jdbc-driver. I am using a PostgreSQL 8.0 database with the 3.* jdbc driver.

    Is it really not possible to recover from a sql-exception and to do anything alternatively? Or is Spring responsable for this abort?


    Martin (Kersten)

  • #2

    Sounds like a jdbc/database limitation. Spring does not do anything special here. If you have a current transaction, once your statement fails your entire transaction should fail. If you want to do additional work, you need to start a new transaction.