Commit a Transaction in Activiti JAVA Delegate Service task?

cancel
Showing results for 
Search instead for 
Did you mean: 
LiamMason
Member II

Commit a Transaction in Activiti JAVA Delegate Service task?

I am working on solution for

1) calling a new Child Process fromn within a Service task of Parent Process.

2) submiting the task form of Child process from  same Service task of Parent Process.

Problem i am facing is Child process is not getting commited in database but process instance id is generated in-memory. Therefore, while submiting the task form of child process, error is thrown saying "could not find process with id xxxx". 

Is there a way to manually/forcefully commit the transaction and can be implemented inside the code logic of javadelegate service task? 

 

So the code will look like : 

public class ExecuteBusinessProcessDelegate implements JavaDelegate{
protected Expression processdeploymentid;//Required field

@Override
	public void execute(DelegateExecution execution) throws Exception {
String deploymentid = expConvUtility.getExpressionAsString(processdeploymentid, execution);
RuntimeService runtimeService = execution.getEngineServices().getRuntimeService();
		ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinitionId,variables);

/// Commit the transaction here >>>>>

/// Submit the task ID here
}
}