Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 6EA55B5DBC4 for ; Sun, 25 Sep 2011 09:00:59 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 31749-04 for ; Sun, 25 Sep 2011 12:00:53 +0000 (UTC) X-Greylist: delayed 00:06:47.077909 by SQLgrey-1.8.0-rc2 Received: from mail-pz0-f44.google.com (mail-pz0-f44.google.com [209.85.210.44]) by mail.postgresql.org (Postfix) with ESMTP id 13500B5DBC8 for ; Sun, 25 Sep 2011 09:00:52 -0300 (ADT) Received: by pzk32 with SMTP id 32so23016373pzk.3 for ; Sun, 25 Sep 2011 05:00:53 -0700 (PDT) Received: by 10.68.5.1 with SMTP id o1mr22470837pbo.20.1316951643855; Sun, 25 Sep 2011 04:54:03 -0700 (PDT) Received: from [10.1.1.6] (124-148-242-247.dyn.iinet.net.au. [124.148.242.247]) by mx.google.com with ESMTPS id p9sm20544839pbq.12.2011.09.25.04.54.01 (version=SSLv3 cipher=OTHER); Sun, 25 Sep 2011 04:54:03 -0700 (PDT) Message-ID: <4E7F1655.5030700@ringerc.id.au> Date: Sun, 25 Sep 2011 19:53:57 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2 MIME-Version: 1.0 To: =?UTF-8?B?UmFkb3PFgmF3IFNtb2d1cmE=?= CC: Amar Dhole , "'pgsql-jdbc@postgresql.org'" Subject: Re: use of savepoint in containter managed transaction References: <56e0d51a0da22ca7628aa2469cdeee8c@mail.softperience.eu> In-Reply-To: <56e0d51a0da22ca7628aa2469cdeee8c@mail.softperience.eu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201109/111 X-Sequence-Number: 22229 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