cancel
Showing results for 
Search instead for 
Did you mean: 

Persisting variables that are long Strings throws Exception

jmaru
Champ in-the-making
Champ in-the-making
Hi all,

I am running the Activiti engine against H2 database with history level set to 'full'. When I set a variable with a value which is a large XML string, I get the following exception. First of all, is this just specific to H2 and will it go away if I move to PostGres/Oracle? If not, how can I store a String which has more than 4000 characters using variables in Activiti?

Thanks,
Jeegar


### Cause: org.h2.jdbc.JdbcSQLException: Value too long for column "TEXT_ VARCHAR(4000)": "STRINGDECODE('<Data xmlns=\""http://xml.odc.com/XMLSchema\"">\n  <Request>\n    <DARequestID>1348500422386… (6271)"; SQL statement:
insert into ACT_HI_DETAIL (ID_, TYPE_, PROC_INST_ID_, EXECUTION_ID_, ACT_INST_ID_, TASK_ID_, NAME_, REV_, VAR_TYPE_, TIME_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_)
    values (
      ?,
      'VariableUpdate',
      ?,
6 REPLIES 6

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Create a bytearray from it…. That way it is stored in te bytearray table which does not have te limit of 4000 chars. The other solution is to change the table definition…

adevore
Champ in-the-making
Champ in-the-making
Are there any side effects of removing the limit of 4000? Preferably, I would rather not have a limit but I understand that removing the limit could affect things like indices. So is there anything internal that depends on the limit 4000 for the "text_" column in ACT_HI_DETAIL?

For more context we're using Postgres, which shouldn't make a difference, and getting the a similar error: "org.postgresql.util.PSQLException: ERROR: value too long for type character varying(4000)". After completing a task it tries to insert all our data into the "text_" column of ACT_HI_DETAIL.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Anton,

LongString has changed during the last 3 years. Are you aware of these changes?
e.g. https://forums.activiti.org/content/insert-acthivarinst-causes-ora-01401-inserted-value-too-large-co...

Regards
Martin

adevore
Champ in-the-making
Champ in-the-making
I wasn't aware of that article but unless the fix introduced works with Postgres then I don't see how it would help. We're on version 5.19.0 of Activiti which I believe is higher than the version in that forum.

We haven't written any code to touch ACT_HI_DETAIL specifically, this is internal to Activiti in terms of how it tries to complete a User Task. We try to complete a task and Activiti attempts to store all the information from a form in the "text_" column in ACT_HI_DETAIL. I'm simply asking if there is a known reason for setting a limit to 4000 characters and what are the repercussions of removing that limit.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Anton,

I am not sure now (it was a long time ago) :-), but oracle has limit for varchar2 column size (2000 or 4000 chars). That's why there is this limit.

Regards
Martin

adevore
Champ in-the-making
Champ in-the-making
Okay, but I'm using Postgres, not Oracle. So it sounds like there is no significant reason for the limit and no negative side effects or removing the limit.

Anton