From 9a94ecf85e323321e23df8a93ad206c4a699d3fd Mon Sep 17 00:00:00 2001 From: Christian Wagner Date: Tue, 3 Feb 2015 09:17:14 +0100 Subject: serialize ExecutionContext data in a single database field --- .../moa/id/process/dao/ProcessInstanceStore.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 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 625199cd2..c6bf86823 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,19 +1,18 @@ package at.gv.egovernment.moa.id.process.dao; import java.io.Serializable; -import java.util.HashMap; import java.util.Map; import javax.persistence.Column; -import javax.persistence.ElementCollection; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; -import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.Lob; import javax.persistence.Table; +import org.hibernate.internal.util.SerializationHelper; + import at.gv.egovernment.moa.id.process.ProcessInstanceState; @Entity @@ -39,8 +38,7 @@ public class ProcessInstanceStore { @Column(name = "executionContextData", nullable = false) @Lob - @ElementCollection(fetch=FetchType.EAGER) - private Map executionContextData = new HashMap<>(); + private byte[] executionContextData; public String getProcessInstanceId() { return processInstanceId; @@ -58,8 +56,9 @@ public class ProcessInstanceStore { return processState; } + @SuppressWarnings("unchecked") public Map getExecutionContextData() { - return executionContextData; + return (Map) SerializationHelper.deserialize(executionContextData); } public void setProcessInstanceId(String processInstanceId) { @@ -79,7 +78,7 @@ public class ProcessInstanceStore { } public void setExecutionContextData(Map executionContextData) { - this.executionContextData = executionContextData; + this.executionContextData = SerializationHelper.serialize((Serializable) executionContextData); } } -- cgit v1.2.3