Hi,
I've encountered the error described below (occured with Activiti BPM 5.18) while playing with ActivityBehavior .
I'm just wondering whether it is an issue or I've just misused a ActivityExecution reference.
I've made a simple unit test consisting of a start event, a service task and a none end event.
The service task just calls the Java test.BpmTaskUnitTest1 class below.
package test;
import org.activiti.engine.impl.pvm.PvmActivity;
import org.activiti.engine.impl.pvm.delegate.ActivityBehavior;
import org.activiti.engine.impl.pvm.delegate.ActivityExecution;
public class BpmTaskUnitTest1 implements ActivityBehavior {
/**
* Set serial version
*/
private static final long serialVersionUID = 1L;
@Override
public void execute(ActivityExecution execution) throws Exception {
PvmActivity activity = execution.getActivity();
System.out.println("[DEBUG] —-> call ActivityExecution.take");
execution.take(activity.getOutgoingTransitions().get(0));
System.out.println("[DEBUG] —-> set variable");
execution.setVariable("variable", "myValue");
}
}
When stated the process raises the exception of "java.sql.SQLIntegrityConstraintViolationException: ORA-02292: integrity constraint (OGW_BPM_3.ACT_FK_VAR_EXE) violated - child record found.
Setting the debug level for both iBatis and Activiti log, I observed that DbSqlSession class tried to insert a "VariableInstanceEntity" while there wasn't a corresponding parent table record any longer:
… persistence.entity.ExecutionEntity - destroying ProcessInstance[712534]
…
… impl.db.DbSqlSession - flush summary: 10 insert, 0 update, 0 delete.
…
… impl.db.DbSqlSession - insert VariableInstanceEntity[id=712541, name=variable, …
…
impl.interceptor.CommandContext - Error while closing command context org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException:
ORA-02291: integrity constraint (OGW_BPM.ACT_FK_VAR_PROCINST) violated - parent key not found
…
Bye.
Andrea