Re: JPA + Postgres = autocommit?

Поиск
Список
Период
Сортировка
От Davygora, Yuriy
Тема Re: JPA + Postgres = autocommit?
Дата
Msg-id B204CB55F9D32D41A9A5413EA3F13F8C3BEC7155@email.sulzer.de
обсуждение исходный текст
Ответ на Re: JPA + Postgres = autocommit?  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
Ответы Re: JPA + Postgres = autocommit?  (Lachezar Dobrev <l.dobrev@gmail.com>)
Re: JPA + Postgres = autocommit?  (Lachezar Dobrev <l.dobrev@gmail.com>)
Список pgsql-jdbc

 

  Hello Vladimir,

 

  we do use a Payara data source, in that we configure the connection in Payara’s domain.xml. And no, it does not work, at least in the release that we are using (4.1.1.161). If I, however, in my code do the following:

 

 Connection con = entityManager.unwrap(Connection.class);

  con.setAutoCommit(false);

 

  then everything works fine.

 

  This is why I said in my mail, that this might be actually a Payara bug.

 

  Best regards,

  Yuriy

 

Von: Vladimir Sitnikov [mailto:sitnikov.vladimir@gmail.com]
Gesendet: Dienstag, 26. Juli 2016 13:22
An: Davygora, Yuriy <Yuriy.Davygora@sulzer.de>
Cc: List <pgsql-jdbc@postgresql.org>
Betreff: Re: [JDBC] JPA + Postgres = autocommit?

 

 

Yuriy>1.       In PgConnection.java, the autocommit is initially set to true in the declaration (private boolean autocommit = true). In the constructor of the PgConnection class, several options are checked (PGProperty), but there is none that has to do with autocommit. Thus, unless, the client explicitely calls setAutoCommit(false), it will remain true.

 

Just for the reference, the specification (see Connection#setAutoCommit javadoc) states that "By default, new connections are in auto-commit mode"


Yuriy>We are using a JTA data source and the transactions are managed by the JEE container

Why don't you use Payara's data source then?
It should solve the problem as Payara seems to have some setAutoCommit logic: https://github.com/payara/Payara/search?utf8=%E2%9C%93&q=setautocommit

 

Vladimir


Sulzer GmbH
Geschäftsführende Gesellschafter: Dr. Johann Sulzer, Albert Euba, Thomas Kahabka
Geschäftsführer: Angelika Rudolph, Harald Lothspeich
Sitz und Registergericht: Stuttgart HRB 7608
http://www.sulzer.de

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Vladimir Sitnikov
Дата:
Сообщение: Re: JPA + Postgres = autocommit?
Следующее
От: "Davygora, Yuriy"
Дата:
Сообщение: Re: JPA + Postgres = autocommit?