li zhi [
http://community.jboss.org/people/lizhi] created the discussion
"To realize countersign by jbpm4.3,I get some thing wrong,why?"
To view the discussion, visit:
http://community.jboss.org/message/543493#543493
--------------------------------------------------------------
The workflow is:
<?xml version="1.0" encoding="UTF-8"?>
<process name="ComplateTaskTest" xmlns="
http://jbpm.org/4/jpdl
http://jbpm.org/4/jpdl">
<start name="start1" g="216,107,48,48">
<transition name="to task" to="task"
g="-35,-17"/>
</start>
<task name="task" g="194,215,92,52"
assignee="lizhi">
<transition name="to state1" to="state1"
g="-43,-17"/>
<transition name="to state2" to="state2"
g="-43,-17"/>
</task>
<state name="state1" g="100,352,92,52"/>
<state name="state2" g="305,352,92,52"/>
</process>
TestUnit:
ProcessEngine processEngine=Configuration.getProcessEngine();
RepositoryService repositoryService=processEngine.getRepositoryService();
ExecutionService executionServcice=processEngine.getExecutionService();
TaskService taskService=processEngine.getTaskService();
String
deployId=repositoryService.createDeployment().addResourceFromClasspath("ComplateTaskTest.jpdl.xml").deploy();
ProcessInstance
pi=executionServcice.startProcessInstanceByKey("ComplateTaskTest");
EnvironmentFactory environmentFactory=(EnvironmentFactory) processEngine;
Environment environment=environmentFactory.openEnvironment();
DbSession dbSession=environment.get(DbSession.class);
TaskImpl
taskImpl=dbSession.findTaskByExecution(executionServcice.findExecutionById(pi.getId()));
taskImpl.setSignalling(true);
assertEquals("lizhi", taskImpl.getAssignee());
TaskImpl subTask1=taskImpl.createSubTask();
subTask1.setName("subtask1");
subTask1.setAssignee("aaa");
subTask1.setExecution(execution);
subTask1.setSignalling(false);
dbSession.save(subTask1);
TaskImpl subTask2=taskImpl.createSubTask();
subTask2.setName("subtask2");
subTask2.setAssignee("bbb");
subTask2.setExecution(execution);
subTask2.setSignalling(false);
dbSession.save(subTask2);
dbSession.save(taskImpl);
List<Task>
tasks=taskService.createTaskQuery().processInstanceId(pi.getId()).list();
assertEquals(1, tasks.size());
List<Task> subTasks=taskService.getSubTasks(tasks.get(0).getId());
taskService.completeTask(subTasks.get(0).getId());
taskService.completeTask(subTasks.get(1).getId());
pi=executionServcice.findProcessInstanceById(pi.getId());
assertTrue(pi.isActive("task"));
taskService.completeTask(taskImpl.getId(),"to state1");
Then i got:
### EXCEPTION ###########################################
08:22:09,779 INF | [DefaultCommandService] exception while executing command
org.jbpm.pvm.internal.cmd.FindExecutionCmd@196bac4
org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove
deleted object from associations): [org.jbpm.pvm.internal.task.TaskImpl#11]
at org.hibernate.impl.SessionImpl.forceFlush(SessionImpl.java:1041)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:188)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:534)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:526)
at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:241)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:291)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:239)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:192)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:319)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:265)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:242)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:192)
at org.hibernate.engine.Cascade.cascade(Cascade.java:153)
at
org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:154)
at
org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:145)
at
org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:88)
at
org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:58)
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:996)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1141)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:835)
at
org.jbpm.pvm.internal.hibernate.DbSessionImpl.findExecutionById(DbSessionImpl.java:195)
at org.jbpm.pvm.internal.cmd.FindExecutionCmd.execute(FindExecutionCmd.java:48)
at org.jbpm.pvm.internal.cmd.FindExecutionCmd.execute(FindExecutionCmd.java:33)
at
org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:40)
at
org.jbpm.pvm.internal.svc.ExecutionServiceImpl.findProcessInstanceById(ExecutionServiceImpl.java:105)
at com.foxconn.test.CompleteTaskTest.testComplete(CompleteTaskTest.java:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
### EXCEPTION ###########################################
what's this mean?
how can i fulfill this countersign?
i'm a chinese.English is Poor,so i'm sorry.
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/543493#543493]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]