Re: JPA + Postgres = autocommit? - Mailing list pgsql-jdbc
From | Dennis Gesker |
---|---|
Subject | Re: JPA + Postgres = autocommit? |
Date | |
Msg-id | CAJRXDBPWORR=Lfz10j-y3AnVGfECYeMhSr9=s_CB5Des-oBqjw@mail.gmail.com Whole thread Raw |
In response to | JPA + Postgres = autocommit? ("Davygora, Yuriy" <Yuriy.Davygora@sulzer.de>) |
List | pgsql-jdbc |
Also, if the data your are writing is joined to another table you can cache the selected results (using a jpa hint) of the table to which you need to join which can speed things up as well.
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().
Here is my persistence.xml:
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="tsms_pdm" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/PDMDataSource</jta-data-source>
<properties>
<property name="eclipselink.jdbc.cache-statements" value="true" />
<property name="eclipselink.cache.shared.default" value="false" />
<property name="eclipselink.cache.type.default" value="NONE" />
<property name="javax.persistence.query.timeout" value="300000" />
</properties>
</persistence-unit>
</persistence>
And here is an excerpt from the Payara domain.xml:
<jdbc-connection-pool datasource-classname="org.postgresql.ds.PGSimpleDataSource" name="PDMDataSource" res-type="javax.sql.DataSource">
<property name="TargetServerType" value="any"/>
<property name="BinaryTransfer" value="true"/>
<property name="UnknownLength" value="2147483647"/>
<property name="DisableColumnSanitiser" value="false"/>
<property name="UseSpNego" value="false"/>
<property name="SspiServiceClass" value="POSTGRES"/>
<property name="ProtocolVersion" value="0"/>
<property name="LogLevel" value="0"/>
<property name="SendBufferSize" value="-1"/>
<property name="ReceiveBufferSize" value="-1"/>
<property name="LoadBalanceHosts" value="false"/>
<property name="ReadOnly" value="false"/>
<property name="LogUnclosedConnections" value="false"/>
<property name="DatabaseName" value="pdm"/>
<property name="GssLib" value="auto"/>
<property name="CurrentSchema" value="pdm"/>
<property name="PortNumber" value="5432"/>
<property name="DefaultRowFetchSize" value="0"/>
<property name="User" value="pdm_user"/>
<property name="Url" value="jdbc:postgresql://localhost/pdm?"/>
<property name="AllowEncodingChanges" value="false"/>
<property name="PrepareThreshold" value="5"/>
<property name="SocketTimeout" value="0"/>
<property name="HostRecheckSeconds" value="10"/>
<property name="Password" value="tssb"/>
<property name="ConnectTimeout" value="0"/>
<property name="PreparedStatementCacheQueries" value="256"/>
<property name="Compatible" value="9.4"/>
<property name="Ssl" value="false"/>
<property name="PreparedStatementCacheSizeMiB" value="5"/>
<property name="Loglevel" value="0"/>
<property name="LoginTimeout" value="0"/>
<property name="ServerName" value="localhost"/>
<property name="TcpKeepAlive" value="false"/>
</jdbc-connection-pool>
<jdbc-resource pool-name="PDMDataSource" jndi-name="jdbc/PDMDataSource"/>
Am I missing something here? How do I disable the autocommit? Any help would be greatly appreciated.
Best regards,
Yuriy
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 by date: