cancel
Showing results for 
Search instead for 
Did you mean: 

Possible Error in the activiti.oracle.create.engine.sql

casten2809
Champ in-the-making
Champ in-the-making
I use Activiti since maybe one year.

Now I use the ACT_RU_VARIABLE table to get the PROC_INST_ID of the execution.
I use this, becaus I think this is one of the the easiest way to get the PROC_INST_ID.

Now the Problem:
If I create a processdefinition with a Parallel-Gateway( and I know the ExecutionId and the ProcessInstanceId should be differet)
and i look in my database, I see that ExecutionId and the ProcessInstanceId are the same at the table ACT_RU_VARIABLE.

After this I have looked over the document described in the subject and it could be that I find a mistake.

I. This is the statement, where the Execution_ID_ of the ACT_RU_VARIABLE get the ID_ of ACT_RU_EXECUTION. This is OK.

create index ACT_IDX_VAR_EXE on ACT_RU_VARIABLE(EXECUTION_ID_);
alter table ACT_RU_VARIABLE
add constraint ACT_FK_VAR_EXE
foreign key (EXECUTION_ID_)
references ACT_RU_EXECUTION (ID_);

II. But in the following statement the PROC_INST_ID_ of the ACT_RU_VARIABLE get the ID_ of ACT_RU_EXECUTION, too, but it should get the PROC_INST_ID_ of the ACT_RU_EXECUTION.

create index ACT_IDX_VAR_PROCINST on ACT_RU_VARIABLE(PROC_INST_ID_);
alter table ACT_RU_VARIABLE
add constraint ACT_FK_VAR_PROCINST
foreign key (PROC_INST_ID_)
references ACT_RU_EXECUTION(ID_);

Is this a mistake? If not I don't understan why this is like this way
6 REPLIES 6

jbarrez
Star Contributor
Star Contributor
> I see that ExecutionId and the ProcessInstanceId are the same at the table

A process instance in activiti is also an execution. More specifically, a process instance is the root of an execution tree. If your process is simple enough, you will there is only one execution. Which is also your process instance.

In a more complex process, there will be a whole hierarchy of executions for a process instance.

casten2809
Champ in-the-making
Champ in-the-making
>> "In a more complex process, there will be a whole hierarchy of executions for a process instance."

There is the Problem I mean.

When I use a Parallel Gateway there should be two Variables with the same Processinstance ID and different Executionen ID, but there ae only on with the same EXECUTION_ID_ like the PROC_INST_ID_ by the table ACT_RU_VARIABLE.
The Execution ID is thr Processinstaance ID in this table.

jbarrez
Star Contributor
Star Contributor
Well, the Activiti engine is smart enough to recycle certain executions, and reuse the same execution for multiple purposes.
If you could show your problem in a unit test it would clarify things a lot for me.

casten2809
Champ in-the-making
Champ in-the-making
Here an Example of my Database-Entry:
ACT_RU_EXECUTION:
<table>
<th>ID_ </th>
<th>REV_</th>
<th> PROC_INST_ID_ </th>
<th>PARENT_ID_ </th>
<th>  PROC_DEF_ID_</th>
<th>  ACT_ID_</th>
<tr>
<td>3213</td>
<td>5</td>
<td>3213</td>
<td></td>
<td> vertragsanbahnung:48:3210</td>
<td>parallelGateway1</td>
</tr>
<tr>
<td>3366</td>
<td>1</td>
<td>3213</td>
<td>3213</td>
<td>vertragsanbahnung:48:3210</td>
<td>userTask1</td>
</tr>
<tr>
<td>3367</td>
<td>1</td>
<td>3213</td>
<td>3213</td>
<td>vertragsanbahnung:48:3210</td>
<td>userTask2</td>
</tr>
</table>

ACT_RU_VARIABLE
<table>
<th>ID_ </th>
<th>REV_</th>
<th>TYPE_ </th>
<th>NAME_ </th>
<th>EXECUTION_ID_ </th>
<th>PROC_INST_ID </th>
<th>TEXT_</th>
<tr>
<td>3250</td>
<td>1</td>
<td>string</td>
<td>result</td>
<td>3213</td>
<td>3213</td>
<td>400</td>
</tr>
</table>

The Entry by the ACT_RU _VARIABLE should be the variables of the Execution "3367" and not the Variables of the whole Process (3213).

jbarrez
Star Contributor
Star Contributor
Ok I see. Did you try .setVariableLocal (or any method that allows you to put vars locally?)

casten2809
Champ in-the-making
Champ in-the-making
No! I will try it.