[jbpm-dev] [Design of JBoss jBPM] - history problem
galanfish
do-not-reply at jboss.com
Fri Feb 20 00:21:19 EST 2009
i have created a process like this:
JbpmConfiguration environmentFactory = (JbpmConfiguration) getEnvironmentFactory();
| ProcessService processService = environmentFactory.get(ProcessService.class);
| ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
| .startProcess("branch_history_problem")
|
| .startActivity("start", WaitState.class)
| .initial()
| .transition("forkNode")
| .endActivity()
|
| .startActivity("forkNode", ForkActivity.class) // just as org.jbpm.jpdl.internal.activity.ForkActivity
| .transition("leftWait", "to_left")
| .transition("rightWait", "to_right")
| .endActivity()
|
| .startActivity("leftWait", WaitState.class)
| .transition("leftLogic")
| .endActivity()
| .startActivity("leftLogic", WaitStateMaybeExceptionThrowout.class) // may throw out exception or call wait for signal, call historyXX inside
| .transition("join")
| .endActivity()
|
| .startActivity("rightWait", WaitState.class)
| .transition("rightLogic")
| .endActivity()
| .startActivity("rightLogic", WaitStateMaybeExceptionThrowout.class)
| .transition("join")
| .endActivity()
|
| .startActivity("join", JoinActivity.class) // just as org.jbpm.jpdl.internal.activity.JoinActivity
| .transition("end", "to_end")
| .endActivity()
|
| .startActivity("end", AutomaticActivity.class)
| .endActivity()
|
| .endProcess();
|
| /*
| / leftWait(wait state) - leftLogic(wait state) \
| start(wait state) - forkNode join - end
| \ rightWait(wait state) - rightLogic(wait state) /
| */
then, i created a process instance and made it run,
when the acitivty moves to Activity("leftLogic", WaitStateMaybeExceptionThrowout.class) or Activity("rightWait", WaitStateMaybeExceptionThrowout.class)
exception throw out:
Cannot add or update a child row: a foreign key constraint fails (`jbpm_pvm/jbpm_hist_actinst`, CONSTRAINT `FK_HAI_HPI` FOREIGN KEY (`HPI_`) REFERENCES `jbpm_hist_procinst` (`ID_`))
insertSQL= "/* insert org.jbpm.pvm.internal.history.model.HistoryActivityInstanceImpl */
insert into JBPM_HIST_ACTINST
(DBVERSION_, HPI_, ACTIVITY_, EXECUTION_, ACTIVITY_NAME_, START_, END_, DURATION_, TRANSITION_, CLASS_) values (?, ?, ?, ?, ?, ?, ?, ?, ?, 'ACT')"
then i modify the method ActivityStart#process as follow, it seems work ok...
.....
| public void process() {
| Session session = Environment.getFromCurrent(Session.class);
|
| // modification begins
| org.jbpm.pvm.internal.model.ExecutionImpl tmp = execution;
| while(tmp.getParent() != null){
| tmp = tmp.getParent();
| }
| // ends
|
| HistoryProcessInstance historyProcessInstanceImpl = (HistoryProcessInstance)
| session.load(HistoryProcessInstanceImpl.class, tmp.getId()/*execution.getId()*/); //..
|
| HistoryActivityInstanceImpl historyActivityInstanceImpl =
| createHistoryActivityInstance(historyProcessInstanceImpl);
|
| session.save(historyActivityInstanceImpl);
|
| execution.setHistoryActivityInstanceDbid(historyActivityInstanceImpl.getDbid());
| }
| .....
is there something i missed or?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4211684#4211684
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4211684
More information about the jbpm-dev
mailing list