cancel
Showing results for 
Search instead for 
Did you mean: 

Insert Variables per SQL in ACT_RU_VARIABLE

cyr1
Champ in-the-making
Champ in-the-making
We had to change the handling of the tasks in our application.
Now i have old tasks which don't have a certain variable in the execution and would therefore be lost for the current assignee.

i wonder now if i can add variables in the exectution when i just add them per SQL in ACT_RU_VARIABLE like:

INSERT INTO ACT_RU_VARIABLE (ID_, REV_,TYPE_, NAME_,EXECUTION_ID_, PROC_INST_ID_, TEXT_) VALUES ('1','1','string', 'varName', 1234, 1234, 'varValue')

The values for EXECUTION_ID_ and PROC_INST_ID_ are not the problem. I can take them from ACT_RU_TASK.
But what is whit the ID_?
Can i just use MAX(ID_) +1? or will this mess up other processes?

thx
cyr
2 REPLIES 2

jbarrez
Star Contributor
Star Contributor
No this will mess up other processes. Activiti uses a class called DbIdGenerator that generates these ids (they are strings, too!)

What you also could do, is create VariableInstanceEntity objects yourself, and save them using a custom Activiti command. That way, it will properly use the id generation.

cyr1
Champ in-the-making
Champ in-the-making
thx for your answer. tought it wouldn't be a simple SQL Query 😉