Re: use of savepoint in containter managed transaction - Mailing list pgsql-jdbc

From Craig Ringer
Subject Re: use of savepoint in containter managed transaction
Date
Msg-id 4E7F1655.5030700@ringerc.id.au
Whole thread Raw
In response to Re: use of savepoint in containter managed transaction  (Radosław Smogura <rsmogura@softperience.eu>)
List 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

pgsql-jdbc by date:

Previous
From: Mikko Tiihonen
Date:
Subject: Patch for binary transfer of UUID type
Next
From: "Craig Golby"
Date:
Subject: Re: JVM & JDBC Upgrade --- Help !!