Re: JPA + Postgres = autocommit? - Mailing list pgsql-jdbc

From rob stone
Subject Re: JPA + Postgres = autocommit?
Date
Msg-id 1469483299.7543.9.camel@gmail.com
Whole thread Raw
In response to JPA + Postgres = autocommit?  ("Davygora, Yuriy" <Yuriy.Davygora@sulzer.de>)
Responses Re: JPA + Postgres = autocommit?
Re: JPA + Postgres = autocommit?
List pgsql-jdbc
On Mon, 2016-07-25 at 06:54 +0000, Davygora, Yuriy wrote:
>  
>   Hello,
>  
>   I am having a small but severe Problem with PostgreSQL. At our
> company, we are currently developing a business application in Java
> EE 7 running on a Payara (Glassfish fork) 4 server (with Eclipselink)
> and we are using Postgres 9.5 as our database and the postgresql-
> 9.4.1208 JDBC driver. Now, it seems that the connection to the
> PostgreSQL database is in an autocommit mode. Transactions (both
> container and bean managed) cannot be rolled back, every single SQL
> command is executed and commited on flush().
>  
>  

Hello,

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;

See

https://www.postgresql.org/docs/9.6/static/app-psql.html#APP-PSQL-VARIA
BLES

for more information about this setting in psql.



HTH,

Rob


pgsql-jdbc by date:

Previous
From: Dennis Gesker
Date:
Subject: Re: JPA + Postgres = autocommit?
Next
From: John R Pierce
Date:
Subject: Re: JPA + Postgres = autocommit?