duplicate database records on set task variables
makvell Mar 16, 2018 12:09 PMI have a project with data model that has a "Client" object (JPA) with "documents" field (Set of ClDocument (JPA) objects).
they are described as follows:
@javax.persistence.Entity
public class Client implements java.io.Serializable {
@javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.AUTO, generator = "CLIENT_ID_GENERATOR")
@javax.persistence.Id
@javax.persistence.SequenceGenerator(sequenceName = "CLIENT_ID_SEQ", name = "CLIENT_ID_GENERATOR")
private java.lang.Long id;
@javax.persistence.OneToMany(fetch = javax.persistence.FetchType.EAGER, cascade = { javax.persistence.CascadeType.ALL })
private java.util.Set<ClDocument> documents;
...
@javax.persistence.Entity
public class ClDocument implements java.io.Serializable {
@javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.AUTO, generator = "CLDOCUMENT_ID_GENERATOR")
@javax.persistence.Id
@javax.persistence.SequenceGenerator(name = "CLDOCUMENT_ID_GENERATOR", sequenceName = "CLDOCUMENT_ID_SEQ")
private java.lang.Long id;
private java.lang.String name;
@javax.persistence.Column(length = 2000)
private java.lang.String description;
...
In another project where the model is added as a dependency created the process with one human task, where input and output has name = client, and type = Client. We use an external user interface that communicates with the backend through the rest services deployed on the same server where the bpm is deployed. There is a call that postpones the task with code like this:
RemoteRestRuntimeEngineBuilder builder = RemoteRuntimeEngineFactory.newRestBuilder()
.addUrl(new URL("URL here"))
.addUserName("username")
.addPassword("password")
.addDeploymentId(DEPLOYMENT_ID)
.addProcessInstanceId(instanceId);
engine = builder.disableTaskSecurity().build();
((RemoteRuntimeEngine) runtime).getRemoteTaskService().addOutputContent(taskId, taskData);
Our problem - UI sends us an object client with list of 3 documents, but after call this code, in database we see 6 documents. if you take the task again and postpone it again, the number of documents in the database will increase again.
I do not understand why this happens, maybe it's some known problem or misconfiguration?