Hi amitjain4
Thank you for reaching out to us. We have also created a SUPPORT ticket https://app.camunda.com/jira/browse/SUPPORT-6670 in order to track the progress of this issue.
Here is an explanation for the issue:
This error can occur if you store huge string or large amount of data in a variable of type "String". Internally, the process engine uses a VARCHAR field which has a limit of maximum 4000 characters (it varies for different databases) to store a variable of type String.
If you need to store longer documents, you can tell the process engine to persist a String as a Java Serializable value. This can be done the following way using the Java API:
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.variable.Variables;
import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats;
public class SomeClass {
protected ProcessEngine processEngine;
public void startProcess() {
String aLongStringValue = repeat("a", 5000);
RuntimeService runtimeService = processEngine.getRuntimeService();
VariableMap variables = Variables.createVariables();
variables.putValueTyped("var", Variables
.objectValue(aLongStringValue)
.serializationDataFormat(SerializationDataFormats.JAVA) .create());
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess", variables);
}
protected String repeat(String string, int times) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < times; i++) {
sb.append(string);
}
return sb.toString();
}
}
The snippet
variables.putValueTyped("var", Variables
.objectValue(aLongStringValue)
.serializationDataFormat(SerializationDataFormats.JAVA)
.create());
creates a process variables that is going to be serialized using standard Java serialization. The serialized byte stream is then stored in the database in a byte array field of arbitrary length.
For general documentation on process variables and the different value types, please see the user guide https://docs.camunda.org/manual/7.11/user-guide/process-engine/variables/
Best regards,
Garima
Hi amitjain4
Thank you for reaching out to us. We have also created a SUPPORT ticket https://app.camunda.com/jira/browse/SUPPORT-6670 in order to track the progress of this issue.
Here is an explanation for the issue:
This error can occur if you store huge string or large amount of data in a variable of type "String". Internally, the process engine uses a VARCHAR field which has a limit of maximum 4000 characters (it varies for different databases) to store a variable of type String.
If you need to store longer documents, you can tell the process engine to persist a String as a Java Serializable value. This can be done the following way using the Java API:
The snippet
variables.putValueTyped("var", Variables .objectValue(aLongStringValue) .serializationDataFormat(SerializationDataFormats.JAVA) .create());
creates a process variables that is going to be serialized using standard Java serialization. The serialized byte stream is then stored in the database in a byte array field of arbitrary length.
For general documentation on process variables and the different value types, please see the user guide https://docs.camunda.org/manual/7.11/user-guide/process-engine/variables/
Best regards,
Garima