cancel
Showing results for 
Search instead for 
Did you mean: 

com.mysql.jdbc.MysqlDataTruncation: Data too long for column TEXT at row

pushpindersingh
Champ in-the-making
Champ in-the-making
Hi All,
We are getting following while saving a json value with varchar size > 65,535 on mysql (version 5.1.x) database
com.mysql.jdbc.MysqlDataTruncation: Data too long for column TEXT at row

I wonder what is right way to fix this problem.

I can think of two way:
1. Changing table ACT_RU_VARIABLE column TEXT_ from varchar(4000) to TEXT
2. Storing json value in some other database outside Activiti database.

I will like to hear how other solved this problem.

Thanks in advance.
3 REPLIES 3

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

Which activiti version do you use?
I think since 5.15 there is org.activiti.engine.impl.variable.LongStringType which handles long strings and stores them as Serializable type.
(ACT_GE_BYTEARRAY)
Regards
Martin

pushpindersingh
Champ in-the-making
Champ in-the-making
Martin, first thanks for quick response.
We are using 5.15

Need more help to use LongStringType.
Currently to store our json object we created class JsonFormType as
<code>
public class JsonFormType extends AbstractFormType implements Serializable{
private static final long serialVersionUID = 1L;

@Override
public String getName() {
  return "json";
}

@Override
public Object convertFormValueToModelValue(String propertyValue) {
  return propertyValue;
}

@Override
public String convertModelValueToFormValue(Object modelValue) {
  return modelValue != null ? modelValue.toString() : null;
}
}
</code>

and formProperty have type as json as below:
<code>
        <activiti:formProperty id="someJasonId" name="Some Json Object" type="json" required="true"></activiti:formProperty>
</code>

Now I wonder where LongStringType  will fit?
Am I suppose to change JsonFormType class to return LongStringType in convertFormValueToModelValue  or should be replacing json to longString in formProperty as
<code>
       <activiti:formProperty id="someJasonId" name="Some Json Object" type="longString" required="true"></activiti:formProperty>
</code>

Thanks in advance any hint or advise.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

From my point of view there is no need to create any new type. Your json variable should be recognized automatically as LongStringType (put breakpoint to LongStringType class) and it should be stored as
BYTES_ LONGBLOB,

in mysql.

If it does not help - create jUnit test
http://forums.activiti.org/content/sticky-how-write-unit-test

Regards
Martin
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.