Mercurial > dive4elements > river
changeset 9272:1d59da89b00d
Fixed: fix_analysis_year function fo datacage closed current database connection.
building datacage now wrapepd in transaction
author | gernotbelger |
---|---|
date | Thu, 19 Jul 2018 16:37:04 +0200 |
parents | f48a8dc78529 |
children | 1b2623dff742 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/Recommendations.java |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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(