diff --git a/pom.xml b/pom.xml
index cfc2951ea12..7fa30168f70 100644
--- a/pom.xml
+++ b/pom.xml
@@ -385,7 +385,7 @@
com.zaxxer
HikariCP
- 3.3.1
+ 3.4.5
org.slf4j
diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/helpers/ObjectUpdater.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/helpers/ObjectUpdater.java
index 7f9ea5da942..f0be487d871 100644
--- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/helpers/ObjectUpdater.java
+++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/helpers/ObjectUpdater.java
@@ -570,43 +570,44 @@ public ModifyObjectResult modifyObjectDynamicallyAttem
LOGGER_PERFORMANCE.debug("> modify object dynamically {}, oid={}", type.getSimpleName(), oid);
- Session session = baseHelper.beginTransaction();
+ try (Session session = baseHelper.beginTransaction()) {
- PrismObject objectBefore;
- Collection extends ItemDelta, ?>> modifications;
- try {
- objectBefore = objectRetriever.getObjectInternal(session, type, oid, getOptions, true);
- LOGGER.trace("Object retrieved:\n{}", objectBefore.debugDumpLazily(1));
+ PrismObject objectBefore;
+ Collection extends ItemDelta, ?>> modifications;
+ try {
+ objectBefore = objectRetriever.getObjectInternal(session, type, oid, getOptions, true);
+ LOGGER.trace("Object retrieved:\n{}", objectBefore.debugDumpLazily(1));
- // Intentionally within this try-catch block because this call must be covered by proper exception handling.
- modifications = modificationsSupplier.get(objectBefore.asObjectable());
- LOGGER.trace("Modifications computed:\n{}", DebugUtil.debugDumpLazily(modifications, 1));
- } catch (ObjectNotFoundException ex) {
- GetOperationOptions rootOptions = SelectorOptions.findRootOptions(getOptions);
- baseHelper.rollbackTransaction(session, ex, result, !GetOperationOptions.isAllowNotFound(rootOptions));
- throw ex;
- } catch (SchemaException ex) {
- baseHelper.rollbackTransaction(session, ex, "Schema error while getting object with oid: "
- + oid + ". Reason: " + ex.getMessage(), result, true);
- throw ex;
- } catch (DtoTranslationException | RuntimeException ex) {
- baseHelper.handleGeneralException(ex, session, result);
- throw new AssertionError("shouldn't be here");
- }
+ // Intentionally within this try-catch block because this call must be covered by proper exception handling.
+ modifications = modificationsSupplier.get(objectBefore.asObjectable());
+ LOGGER.trace("Modifications computed:\n{}", DebugUtil.debugDumpLazily(modifications, 1));
+ } catch (ObjectNotFoundException ex) {
+ GetOperationOptions rootOptions = SelectorOptions.findRootOptions(getOptions);
+ baseHelper.rollbackTransaction(session, ex, result, !GetOperationOptions.isAllowNotFound(rootOptions));
+ throw ex;
+ } catch (SchemaException ex) {
+ baseHelper.rollbackTransaction(session, ex, "Schema error while getting object with oid: "
+ + oid + ". Reason: " + ex.getMessage(), result, true);
+ throw ex;
+ } catch (DtoTranslationException | RuntimeException ex) {
+ baseHelper.handleGeneralException(ex, session, result);
+ throw new AssertionError("shouldn't be here");
+ }
- if (modifications.isEmpty() && !RepoModifyOptions.isForceReindex(modifyOptions)) {
- LOGGER.debug("Modification list is empty, nothing was modified.");
- session.getTransaction().commit();
- result.recordStatus(OperationResultStatus.SUCCESS, "Computed modification list is empty");
- return new ModifyObjectResult<>(objectBefore, objectBefore, modifications);
- }
+ if (modifications.isEmpty() && !RepoModifyOptions.isForceReindex(modifyOptions)) {
+ LOGGER.debug("Modification list is empty, nothing was modified.");
+ session.getTransaction().commit();
+ result.recordStatus(OperationResultStatus.SUCCESS, "Computed modification list is empty");
+ return new ModifyObjectResult<>(objectBefore, objectBefore, modifications);
+ }
- try {
- // TODO: eliminate redundant getObjectInternal call in modifyObjectAttempt
- return modifyObjectAttempt(type, oid, modifications, null, modifyOptions, attempt, result, sqlRepositoryService,
- noFetchExtensionValueInsertionForbidden, session);
- } catch (PreconditionViolationException e) {
- throw new SystemException("Unexpected PreconditionViolationException: " + e.getMessage(), e);
+ try {
+ // TODO: eliminate redundant getObjectInternal call in modifyObjectAttempt
+ return modifyObjectAttempt(type, oid, modifications, null, modifyOptions, attempt, result, sqlRepositoryService,
+ noFetchExtensionValueInsertionForbidden, session);
+ } catch (PreconditionViolationException e) {
+ throw new SystemException("Unexpected PreconditionViolationException: " + e.getMessage(), e);
+ }
}
}
diff --git a/repo/repo-sqlbase/src/main/java/com/evolveum/midpoint/repo/sqlbase/DataSourceFactory.java b/repo/repo-sqlbase/src/main/java/com/evolveum/midpoint/repo/sqlbase/DataSourceFactory.java
index ee450e78ed1..62c03ae2955 100644
--- a/repo/repo-sqlbase/src/main/java/com/evolveum/midpoint/repo/sqlbase/DataSourceFactory.java
+++ b/repo/repo-sqlbase/src/main/java/com/evolveum/midpoint/repo/sqlbase/DataSourceFactory.java
@@ -111,6 +111,7 @@ private HikariConfig createHikariConfig() {
}
config.setInitializationFailTimeout(configuration.getInitializationFailTimeout());
+ config.setAutoCommit(false);
return config;
}