diff options
author | Thomas Knall <t.knall@datentechnik-innovation.com> | 2015-02-02 14:03:17 +0100 |
---|---|---|
committer | Thomas Knall <t.knall@datentechnik-innovation.com> | 2015-02-02 14:03:17 +0100 |
commit | 036c31a1dcff04784946159c2612e48bf2ec9e0e (patch) | |
tree | ff258dc17f949bd1d1c57749f43b3e1630ef287a /id/server/idserverlib/src/main/java/at | |
parent | 2e27b939251017882b323b6478c345439d486494 (diff) | |
download | moa-id-spss-036c31a1dcff04784946159c2612e48bf2ec9e0e.tar.gz moa-id-spss-036c31a1dcff04784946159c2612e48bf2ec9e0e.tar.bz2 moa-id-spss-036c31a1dcff04784946159c2612e48bf2ec9e0e.zip |
Fix persistence.
Diffstat (limited to 'id/server/idserverlib/src/main/java/at')
2 files changed, 15 insertions, 8 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStore.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStore.java index 010f8d984..625199cd2 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStore.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStore.java @@ -1,6 +1,7 @@ package at.gv.egovernment.moa.id.process.dao; import java.io.Serializable; +import java.util.HashMap; import java.util.Map; import javax.persistence.Column; @@ -39,7 +40,7 @@ public class ProcessInstanceStore { @Column(name = "executionContextData", nullable = false) @Lob @ElementCollection(fetch=FetchType.EAGER) - private Map<String, Serializable> executionContextData; + private Map<String, Serializable> executionContextData = new HashMap<>(); public String getProcessInstanceId() { return processInstanceId; diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStoreDAOImpl.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStoreDAOImpl.java index e9e977d53..0a50afc6c 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStoreDAOImpl.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStoreDAOImpl.java @@ -67,6 +67,11 @@ public class ProcessInstanceStoreDAOImpl implements ProcessInstanceStoreDAO { MOASessionDBUtils.closeSession(); } } + if (result != null) { + log.debug("Found process instance store for instance '{}'.", processInstanceId); + } else { + log.debug("Unable to find process instance store for instance '{}'.", processInstanceId); + } return result; } @@ -74,14 +79,15 @@ public class ProcessInstanceStoreDAOImpl implements ProcessInstanceStoreDAO { public void remove(String processInstanceId) throws MOADatabaseException { log.debug("Delete the ProcessInstanceStore for id='{}' from the database.", processInstanceId); - ProcessInstanceStore toBeDeleted = load(processInstanceId); - boolean deleted = MOASessionDBUtils.delete(toBeDeleted); - if (!deleted) { - log.warn("Could not delete the ProcessInstanceStore with process instance id '{}'", processInstanceId); - throw new MOADatabaseException("Could not delete the ProcessInstanceStore with process instance id '" - + processInstanceId + "'."); - } + if (toBeDeleted != null) { + if (!MOASessionDBUtils.delete(toBeDeleted)) { + log.warn("Could not delete the ProcessInstanceStore with process instance id '{}'", processInstanceId); + throw new MOADatabaseException("Could not delete the ProcessInstanceStore with process instance id '" + + processInstanceId + "'."); + } + } else + log.trace("ProcessInstanceStore for id='{}' was not found and could therefore not be deleted.", processInstanceId); } } |