[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:
Robert von Burg 2014-03-03 23:22:55 +01:00
parent 9555f562fa
commit 692f80fa61
1 changed files with 4 additions and 3 deletions

View File

@ -51,11 +51,12 @@ 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();
// and close the connection, but not catching, as otherwise we can't rollback in exception case
this.connection.close();
}
}
@Override