Re: JPA + Postgres = autocommit?

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: rob stone <floriparob(at)gmail(dot)com>
Cc: John R Pierce <pierce(at)hogranch(dot)com>, List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JPA + Postgres = autocommit?
Date: 2016-07-25 23:05:59
Message-ID: CADK3HH++oGoGNhjk8oPL0FLttdV6OuOzRBmMkrH4qtDO4rg4xA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On 25 July 2016 at 18:48, rob stone <floriparob(at)gmail(dot)com> wrote:

> On Mon, 2016-07-25 at 14:53 -0700, John R Pierce wrote:
> > On 7/25/2016 2:48 PM, rob stone wrote:
> > > I know nothing about Payara, etc. but the "traditional" way of
> > > handling
> > > this in an application is to:-
> > >
> > > BEGIN;
> > >
> > > Do your inserts/updates etc.
> > >
> > > COMMIT; or if you caught any errors during the inserting/updating,
> > > then
> > >
> > > ROLLBACK;
> >
> > Not in Java/JDBC applications. Rather, they have the concept of
> > autocommit on/off, you configure it on a per connection basis.
> > commit() and rollback() are API calls to the java database
> > connection
> > object.
> >
>
> True, however issuing a BEGIN turns autocommit off.
>

Please don't do that in JDBC. This will not have the results you expect.
The driver needs to know if it is in autocommit mode or not

>
> Yes. I'd experiment with <property name="AutoCommit" value="false" />
> or maybe value="off" and see if it makes a difference.
>
>
Yes

Dave Cramer

davec(at)postgresintl(dot)com
www.postgresintl.com

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Davygora, Yuriy 2016-07-26 09:55:41 Re: JPA + Postgres = autocommit?
Previous Message rob stone 2016-07-25 22:48:21 Re: JPA + Postgres = autocommit?