aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src/main/java')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/process/dao/ProcessInstanceStoreDAOImpl.java50
1 files changed, 27 insertions, 23 deletions
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 f5fb71145..4b7468013 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
@@ -46,24 +46,26 @@ public class ProcessInstanceStoreDAOImpl implements ProcessInstanceStoreDAO {
ProcessInstanceStore result = null;
Transaction tx = null;
- try {
- synchronized (session) {
+ synchronized (session) {
+ try {
+
tx = session.beginTransaction();
// select all where processInstanceId equals processInstanceId
Criteria criteria = session.createCriteria(ProcessInstanceStore.class);
criteria.add(Restrictions.eq("processInstanceId", processInstanceId));
result = (ProcessInstanceStore) criteria.uniqueResult();
tx.commit();
+
+ } catch (Exception e) {
+ log.error("There are multiple persisted processes with the same process instance id '{}'",
+ processInstanceId);
+ if (tx != null) {
+ tx.rollback();
+ }
+ throw e;
+ } finally {
+ MOASessionDBUtils.closeSession();
}
- } catch (Exception e) {
- log.error("There are multiple persisted processes with the same process instance id '{}'",
- processInstanceId);
- if (tx != null) {
- tx.rollback();
- }
- throw e;
- } finally {
- MOASessionDBUtils.closeSession();
}
return result;
}
@@ -74,8 +76,8 @@ public class ProcessInstanceStoreDAOImpl implements ProcessInstanceStoreDAO {
log.debug("Delete the ProcessInstanceStore for id='{}' from the database.", processInstanceId);
ProcessInstanceStore toBeDeleted = load(processInstanceId);
- boolean result = MOASessionDBUtils.delete(toBeDeleted);
- if (result == false) {
+ 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 + "'.");
@@ -90,21 +92,23 @@ public class ProcessInstanceStoreDAOImpl implements ProcessInstanceStoreDAO {
List<ProcessInstanceStore> result = Collections.emptyList();
Transaction tx = null;
- try {
- synchronized (session) {
+ synchronized (session) {
+ try {
+
tx = session.beginTransaction();
// select all
result = session.createCriteria(ProcessInstanceStore.class).list();
tx.commit();
+
+ } catch (Exception e) {
+ log.error("A problem occured while retrieving all stored ProcessInstanceStores.");
+ if (tx != null) {
+ tx.rollback();
+ }
+ throw e;
+ } finally {
+ MOASessionDBUtils.closeSession();
}
- } catch (Exception e) {
- log.error("A problem occured while retrieving all stored ProcessInstanceStores.");
- if (tx != null) {
- tx.rollback();
- }
- throw e;
- } finally {
- MOASessionDBUtils.closeSession();
}
return result;
}