Al Nadein [
http://community.jboss.org/people/matrixpooh] created the discussion
"Cancel a process throws exceptions"
To view the discussion, visit:
http://community.jboss.org/message/558638#558638
--------------------------------------------------------------
Hi,
In my application, I'd like to be able to delete open (pending) process instances. My
process instances usually consists of 2-8 subprocesses. The delete of the parent should be
able to cascade delete its forked executions and its sub-processes, their forked children
and their subprocesses. I'm running into
org.hibernate.exception.ConstraintViolationException: could not delete:
[org.jbpm.pvm.internal.model.ExecutionImpl#23]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at
org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2559)
when doing a cascade delete. Seems that the process attempts to delete the parent record
immediately, without looking for children processes.
Below is the complete unit test to reproduce the issue:
Your input would be highly appreciated.
package workflow;import java.util.HashMap;import java.util.Map;import
junit.framework.Assert;import org.jbpm.api.Configuration;import
org.jbpm.api.Execution;import org.jbpm.api.ExecutionService;import
org.jbpm.api.IdentityService;import org.jbpm.api.ProcessEngine;import
org.jbpm.api.ProcessInstance;import org.jbpm.api.RepositoryService;import
org.jbpm.api.activity.ActivityExecution;import org.jbpm.api.cmd.Command;import
org.jbpm.api.cmd.Environment;import org.junit.After;import org.junit.Before;import
org.junit.Ignore;import org.junit.Test;import org.slf4j.Logger;import
org.slf4j.LoggerFactory;public class OpenProcessWithinProcessTest { private static
final Logger log = LoggerFactory.getLogger(OpenProcessWithinProcessTest.class);
public IdentityService identityService ; public ExecutionService executionService;
public RepositoryService repositoryService; static final String XML_MAIN =
"(){ @Override public Void execute(Environment environment)
throws Exception {
((ActivityExecution)processInstance1).end(Execution.STATE_ENDED); return
null; }}); }}
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/558638#558638]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]