pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <ringerc@ringerc.id.au>
To: Freddie Burgess <fburgess@radiantblue.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Postgres JDBC-hibernate Problem
Date: Wed, 19 Sep 2012 13:31:07 +0800
Message-ID: <5059589B.5020609@ringerc.id.au> (raw)
In-Reply-To: <003b01cd95d6$3babb0a0$b30311e0$@radiantblue.com>
References: <000901cd9039$11ac90f0$3505b2d0$@radiantblue.com>
	<5056A94B.2030304@ringerc.id.au>
	<001001cd94f9$1c1f8e10$545eaa30$@radiantblue.com>
	<5057F892.7060208@ringerc.id.au>
	<003b01cd95d6$3babb0a0$b30311e0$@radiantblue.com>

On 09/19/2012 03:46 AM, Freddie Burgess wrote:
>
> The Employee ingest behaves a bit differently - it handles transactions
> programmatically, for example:
>
>                    Transaction tx = session.beginTransaction();
>                    session.save(Employee);
>                    tx.commit();
>
> Could it be possible that if an exception is thrown by the session.save()
> method that the transaction might not be rolled back or closed, although no
> errors pertaining to this scenario were recorded in the PostgreSQL log.

It's possible; I don't use Spring, so I can't really say. I know that in 
EJB 3.1 container managed transactions with JTA data sources the 
guarantees are strong:

- If the exception thrown is annotated @ApplicationException then
   rollback is controlled by that annotation; otherwise:

- If it's an unchecked exception, the transaction is rolled back; and

- If it's a checked exception that's properly declared the transaction
   is NOT rolled back

I don't know what Spring's rules are. It's all a bit localized and 
specific to your code, so it's difficult to offer any useful advice at 
this point.

If there's any chance you can cook it down to a small, runnable, 
self-contained test-case that'd be very useful. In my experience when 
I've done so I have, in the process, often found a bug in my code that 
was the cause of the problem. When I don't find an issue in my code I 
usually have something clear that demonstrates a problem and helps 
isolate which project(s) the problem is in.

--
Craig Ringer




view thread (6+ messages)

Message-ID: <5059589B.5020609@ringerc.id.au>
Permalink:  ../5059589B.5020609@ringerc.id.au/
Also on:    postgresql.org/message-id/5059589B.5020609@ringerc.id.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: ringerc@ringerc.id.au, fburgess@radiantblue.com
  Subject: Re: Postgres JDBC-hibernate Problem
  In-Reply-To: <5059589B.5020609@ringerc.id.au>
  References: <000901cd9039$11ac90f0$3505b2d0$@radiantblue.com> <5056A94B.2030304@ringerc.id.au> <001001cd94f9$1c1f8e10$545eaa30$@radiantblue.com> <5057F892.7060208@ringerc.id.au> <003b01cd95d6$3babb0a0$b30311e0$@radiantblue.com> <5059589B.5020609@ringerc.id.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox