[PATCH] Fixed: fix_analysis_year function fo datacage closed current database connection
Wald Commits
scm-commit at wald.intevation.org
Thu Jul 19 16:37:09 CEST 2018
# HG changeset patch
# User gernotbelger
# Date 1532011024 -7200
# Node ID 1d59da89b00d1ff542d35abdf62b4df12bd86dce
# Parent f48a8dc78529986659fb5b24ce0971f7b6aa1623
Fixed: fix_analysis_year function fo datacage closed current database connection.
building datacage now wrapepd in transaction
diff -r f48a8dc78529 -r 1d59da89b00d artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/Recommendations.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/Recommendations.java Thu Jul 19 13:39:27 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/Recommendations.java Thu Jul 19 16:37:04 2018 +0200
@@ -29,7 +29,7 @@
import org.hibernate.Session;
import org.hibernate.SessionFactory;
-
+import org.hibernate.Transaction;
import org.hibernate.jdbc.Work;
import org.dive4elements.artifacts.CallContext;
import org.dive4elements.artifacts.common.utils.Config;
@@ -216,6 +216,11 @@
}
public void recommend( final Map<String, Object> parameters, final String userId, final Node result, final Session systemSession, final CallContext context ) {
+
+ // REMARK: we star a transaction here, because some code (specificely FixAnalysisYearXPathFunction) will execute hibernate queries without directly using the given connection
+ // This will the current connection getting closed, if we are no inside a transaction.
+ final Transaction transaction = systemSession.beginTransaction();
+
systemSession.doWork(new Work() {
@Override
public void execute(final Connection systemConnection)
@@ -240,6 +245,8 @@
}
}
});
+
+ transaction.commit();
}
public void recommend(
More information about the Dive4Elements-commits
mailing list