JDBC feature request: auto savepoint per command - Mailing list pgsql-jdbc

From Tom Lane
Subject JDBC feature request: auto savepoint per command
Date
Msg-id 11539.1177352713@sss.pgh.pa.us
Whole thread Raw
Responses Re: JDBC feature request: auto savepoint per command  (Mark Lewis <mark.lewis@mir3.com>)
Re: JDBC feature request: auto savepoint per command  (Oliver Jowett <oliver@opencloud.com>)
Re: JDBC feature request: auto savepoint per command  (Kris Jurka <books@ejurka.com>)
List pgsql-jdbc
Some folk at JBoss (now part of Red Hat) are complaining to me that
there's no way to deal with failing statements within a transaction
in the context of CMT (Container Managed Transactions).  The normal
advice would be to do SAVEPOINT and RELEASE around each statement,
but they say this is disallowed:

> It's really a question of granularity. When using CMT a global
> transaction is not committed until the end of method completion.
> Prior to the JDBC connection being used, autocommit is set to false
> and the global transaction is officially started. When the global
> transaction completes, the transaction is committed as a whole. JDBC
> Rollback and commit within a managed transaction is prohibited as
> this is the responsibility of the container. So, setting a savepoint
> and rolling back (and subsequently committing) won't work in this
> context which is what the Postgres driver requires.

Can anyone see a solution for this in the context of the existing driver
facilities?  If not, is it reasonable to ask for a driver option to do
auto-savepointing?  There is already an equivalent facility in psql, so
the idea doesn't seem unreasonable to me.

            regards, tom lane

pgsql-jdbc by date:

Previous
From: cvp3-3t1p@spamex.com
Date:
Subject: Using interval type columns in Hibernate
Next
From: Mark Lewis
Date:
Subject: Re: JDBC feature request: auto savepoint per command