[Bugfix] Don't close unopened connection
When a PostgreSQL transaction is opened without any objects being modified or queried, then the connection won't be opened, thus no need to close it.
This commit is contained in:
parent
9555f562fa
commit
692f80fa61
|
@ -51,12 +51,13 @@ public class PostgreSqlStrolchTransaction extends AbstractTransaction {
|
|||
this.resourceDao.commit(txResult);
|
||||
|
||||
// then commit the SQL connection
|
||||
if (this.connection != null)
|
||||
if (this.connection != null) {
|
||||
this.connection.commit();
|
||||
|
||||
// and close the connection, but not catching, as otherwise we can't rollback in exception case
|
||||
this.connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void rollback(TransactionResult txResult) throws Exception {
|
||||
|
|
Loading…
Reference in New Issue