Re: use of savepoint in containter managed transaction

From: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
To: Radosław Smogura <rsmogura(at)softperience(dot)eu>
Cc: Amar Dhole <adhole(at)tibco(dot)com>, "'pgsql-jdbc(at)postgresql(dot)org'" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: use of savepoint in containter managed transaction
Date: 2011-09-25 11:53:57
Message-ID: 4E7F1655.5030700@ringerc.id.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On 23/09/2011 9:58 PM, Radosław Smogura wrote:
> I may suggest You, to try to manually use savepoints and rollbacks by
> explicite specifying such queryies
>
> createStatemnet().executeUpdate("SAVEPOINT ...")
> createStatemnet().executeUpdate(ROLLBACK TO SAVEPOINT....)
> createStatemnet().executeUpdate(RELEASE SAVEPOINT....)
> but do not use COMMIT, nor ROLLBACK, nor PREPARE TRANSACTION.
>
> You will need to put some work to arm your code in necessary try/catch.
>
> If this will work, and consequences of this I don't know (I suppose at
> 80-90% that this should not affect XA, it's really hard to tell at eye
> glance).

Alternately, tell your container you want a non-JTA-managed tansaction
so you don't need to worry about disturbing its view of the transaction
state. That's probably safer, since you want to manage your own
transactions so you don't really want JTA anyway.

--
Craig Ringer

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Craig Golby 2011-09-25 23:16:14 Re: JVM & JDBC Upgrade --- Help !!
Previous Message Mikko Tiihonen 2011-09-24 22:46:57 Patch for binary transfer of UUID type