com.mysql.jdbc.MysqlDataTruncation: Data too long for column TEXT at row
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2014 08:22 PM
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.
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.
Labels:
- Labels:
-
Archive
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2014 04:06 AM
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
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2014 08:30 PM
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.
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.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2014 12:24 AM
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
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
