Data truncation: Data too long for column 'TEXT_' at row 1

We are storing list of values as comma ‘,’ seperated as variable value. When the size of data was less no issues happened, and if data volume was high we are getting below exception:

[org.camunda.bpm.engine.context] [logError] @ 156 : ENGINE-16004 Exception while closing command context: ENGINE-03083 Exception while executing Batch Database Operations with message ’

Error flushing statements. Cause: org.apache.ibatis.executor.BatchExecutorException: org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity.insertVariableInstance (batch index #4) failed. 3 prior sub executor(s) completed successfully, but will be rolled back. Cause: java.sql.BatchUpdateException: Data truncation: Data too long for column ‘TEXT_’ at row 1

Cause: org.apache.ibatis.executor.BatchExecutorException: org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity.insertVariableInstance (batch index #4) failed. 3 prior sub executor(s) completed successfully, but will be rolled back. Cause: java.sql.BatchUpdateException: Data truncation: Data too long for column ‘TEXT_’ at row 1

java.sql.BatchUpdateException: Data truncation: Data too long for column ‘TEXT_’ at row 1
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column ‘TEXT_’ at row 1
'. Flush summary:
[
INSERT HistoricJobLogEventEntity[76886086-c327-11e8-bd8a-0a64e2e674b2]
INSERT HistoricProcessInstanceEventEntity[768441d3-c327-11e8-bd8a-0a64e2e674b2]
INSERT ExecutionEntity[768441d3-c327-11e8-bd8a-0a64e2e674b2]
INSERT VariableInstanceEntity[7686d9e4-c327-11e8-bd8a-0a64e2e674b2]
INSERT MessageEntity[76874f15-c327-11e8-bd8a-0a64e2e674b2]
]

at org.camunda.bpm.engine.rest.sub.repository.impl.ProcessDefinitionResourceImpl.startProcessInstance(ProcessDefinitionResourceImpl.java:125)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:76)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:148)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:191)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:243)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:103)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:493)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:415)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:104)

org.camunda.bpm.engine.ProcessEngineException: ENGINE-03083 Exception while executing Batch Database Operations with message ’

Caused by: java.sql.BatchUpdateException: Data truncation: Data too long for column ‘TEXT_’ at row 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.Util.getInstance(Util.java:408)
at com.mysql.jdbc.SQLError.createBatchUpdateException(SQLError.java:1163)
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1778)
at com.mysql.jdbc.PreparedStatement.executeBatchInternal(PreparedStatement.java:1262)
at com.mysql.jdbc.StatementImpl.executeBatch(StatementImpl.java:970)
at org.apache.ibatis.executor.BatchExecutor.doFlushStatements(BatchExecutor.java:122)
… 136 more

Can we change the datatype of TEXT_ column to CLOB? if we modify the column any other impact will occur?

Hi @aravindhrs,

did you try to insert the value as object value instead of a string value?

Object values are stored in another table as CLOB.

Best regards,
Philipp

I have set value as like this:
String usersList = (String) delegateTask.getExecution().getVariable(CamundaConstants.CANDIDATEUSERS);

Instead of this, let me know how it will work, hence “new” operator enforces “Object” rather than literal.
String usersList = new String(delegateTask.getExecution().getVariable(CamundaConstants.CANDIDATEUSERS));

You should try to use the Typed Variable API.

ObjectValue typedObjectValue = Variables.objectValue(myBigString).create();
runtimeService.setVariableLocal(execution.getId(), "bigString", typedObjectValue);
2 Likes

This operation was I’m using for setting candidate users. Will it work if i store it as “Typed Variable API”?

Thanks @Philipp_Ossler I was facing the exact same issue and your suggestion worked like a charm. I feel this should have been the default implementation.

1 Like