TaskInstance.end(transitionName);流转数据库无数据. 已解决~
liuzoe
2009-04-10
在公文流转的时候,
在TaskInstance.end(transitionName);应该触发流程想指定的节点流转.可是查询数据库JBPM_TASKINSTANCE表中不插入数据. 没有发出hibernate的insert语句.只发出了一条Hibernate: select hibernate_sequence.nextval from dual 请问这是什么原因呢? 我的提交公文代码 public String nextStep(long processInstanceId, String actorId, String transitionName) { JbpmContext context = getJbpmContext(); ProcessInstance instance = context.getProcessInstance(processInstanceId); System.out.println("Node Name begin:"+instance.getRootToken().getNode().getName()); //当前节点 String currentNodeName = instance.getRootToken().getNode().getName(); //起点的名称 String startNodeName = instance.getProcessDefinition().getStartState().getName(); //如果是在起点 if(startNodeName.equals(currentNodeName)){ if(transitionName == null){ instance.signal(); }else{ instance.signal(transitionName); } }else{ List taskInstances = context.getTaskMgmtSession().findTaskInstances(actorId); for (Iterator iterator = taskInstances.iterator(); iterator .hasNext();) { TaskInstance ti = (TaskInstance) iterator.next(); if(ti.getProcessInstance().getId() == processInstanceId){ System.out.println("TaskInstance: "+ti); if(transitionName == null){ ti.end(); }else{ System.out.println("TaskInstance.Token.Name begin: "+ti.getActorId()); ti.end(transitionName); System.out.println("TaskInstance.Token.Name end: "+ti.getTask().getName()); } break; } } } //返回转向之后的节点名称 System.out.println("Node Name end:"+instance.getRootToken().getNode().getName()); return instance.getRootToken().getNode().getName(); } 调试信息 Node Name begin:受理 Hibernate: select instances0_.PROCESSINSTANCE_ as PROCESSI4_1_, instances0_.ID_ as ID1_1_, instances0_.NAME_ as NAME6_1_, instances0_.ID_ as ID1_25_0_, instances0_.VERSION_ as VERSION3_25_0_, instances0_.PROCESSINSTANCE_ as PROCESSI4_25_0_, instances0_.TASKMGMTDEFINITION_ as TASKMGMT5_25_0_, instances0_.CLASS_ as CLASS2_25_0_ from JBPM_MODULEINSTANCE instances0_ where instances0_.PROCESSINSTANCE_=? instance.getInstances(): {org.jbpm.taskmgmt.exe.TaskMgmtInstance=org.jbpm.taskmgmt.exe.TaskMgmtInstance@de3c87, org.jbpm.context.exe.ContextInstance=org.jbpm.context.exe.ContextInstance@54919e} Hibernate: select taskinstan0_.ID_ as ID1_29_, taskinstan0_.VERSION_ as VERSION3_29_, taskinstan0_.NAME_ as NAME4_29_, taskinstan0_.DESCRIPTION_ as DESCRIPT5_29_, taskinstan0_.ACTORID_ as ACTORID6_29_, taskinstan0_.CREATE_ as CREATE7_29_, taskinstan0_.START_ as START8_29_, taskinstan0_.END_ as END9_29_, taskinstan0_.DUEDATE_ as DUEDATE10_29_, taskinstan0_.PRIORITY_ as PRIORITY11_29_, taskinstan0_.ISCANCELLED_ as ISCANCE12_29_, taskinstan0_.ISSUSPENDED_ as ISSUSPE13_29_, taskinstan0_.ISOPEN_ as ISOPEN14_29_, taskinstan0_.ISSIGNALLING_ as ISSIGNA15_29_, taskinstan0_.ISBLOCKING_ as ISBLOCKING16_29_, taskinstan0_.TASK_ as TASK17_29_, taskinstan0_.TOKEN_ as TOKEN18_29_, taskinstan0_.PROCINST_ as PROCINST19_29_, taskinstan0_.SWIMLANINSTANCE_ as SWIMLAN20_29_, taskinstan0_.TASKMGMTINSTANCE_ as TASKMGM21_29_ from JBPM_TASKINSTANCE taskinstan0_ where taskinstan0_.ACTORID_=? and taskinstan0_.ISSUSPENDED_<>1 and taskinstan0_.ISOPEN_=1 TaskInstance.Token.Name begin: Token(/) Hibernate: select task0_.ID_ as ID1_16_0_, task0_.NAME_ as NAME2_16_0_, task0_.DESCRIPTION_ as DESCRIPT3_16_0_, task0_.PROCESSDEFINITION_ as PROCESSD4_16_0_, task0_.ISBLOCKING_ as ISBLOCKING5_16_0_, task0_.ISSIGNALLING_ as ISSIGNAL6_16_0_, task0_.CONDITION_ as CONDITION7_16_0_, task0_.DUEDATE_ as DUEDATE8_16_0_, task0_.PRIORITY_ as PRIORITY9_16_0_, task0_.ACTORIDEXPRESSION_ as ACTORID10_16_0_, task0_.POOLEDACTORSEXPRESSION_ as POOLEDA11_16_0_, task0_.TASKMGMTDEFINITION_ as TASKMGM12_16_0_, task0_.TASKNODE_ as TASKNODE13_16_0_, task0_.STARTSTATE_ as STARTSTATE14_16_0_, task0_.ASSIGNMENTDELEGATION_ as ASSIGNM15_16_0_, task0_.SWIMLANE_ as SWIMLANE16_16_0_, task0_.TASKCONTROLLER_ as TASKCON17_16_0_ from JBPM_TASK task0_ where task0_.ID_=? 16:12:45,703 WARN ProxyWarnLog:581 - Narrowing proxy to class org.jbpm.graph.node.TaskNode - this operation breaks == 16:12:45,703 DEBUG GraphElement:165 - event 'task-end' on 'Task(受理)' for 'Token(/)' Hibernate: select events0_.TASK_ as TASK8_1_, events0_.ID_ as ID1_1_, events0_.EVENTTYPE_ as EVENTTYPE2_1_, events0_.ID_ as ID1_9_0_, events0_.EVENTTYPE_ as EVENTTYPE2_9_0_, events0_.TYPE_ as TYPE3_9_0_, events0_.GRAPHELEMENT_ as GRAPHELE4_9_0_ from JBPM_EVENT events0_ where events0_.TASK_=? Hibernate: select runtimeact0_.PROCESSINSTANCE_ as PROCESSI6_1_, runtimeact0_.ID_ as ID1_1_, runtimeact0_.PROCESSINSTANCEINDEX_ as PROCESSI8_1_, runtimeact0_.ID_ as ID1_24_0_, runtimeact0_.VERSION_ as VERSION2_24_0_, runtimeact0_.EVENTTYPE_ as EVENTTYPE3_24_0_, runtimeact0_.TYPE_ as TYPE4_24_0_, runtimeact0_.GRAPHELEMENT_ as GRAPHELE5_24_0_, runtimeact0_.PROCESSINSTANCE_ as PROCESSI6_24_0_, runtimeact0_.ACTION_ as ACTION7_24_0_ from JBPM_RUNTIMEACTION runtimeact0_ where runtimeact0_.PROCESSINSTANCE_=? Hibernate: select events0_.NODE_ as NODE6_1_, events0_.ID_ as ID1_1_, events0_.EVENTTYPE_ as EVENTTYPE2_1_, events0_.ID_ as ID1_9_0_, events0_.EVENTTYPE_ as EVENTTYPE2_9_0_, events0_.TYPE_ as TYPE3_9_0_, events0_.GRAPHELEMENT_ as GRAPHELE4_9_0_ from JBPM_EVENT events0_ where events0_.NODE_=? Hibernate: select events0_.PROCESSDEFINITION_ as PROCESSD5_1_, events0_.ID_ as ID1_1_, events0_.EVENTTYPE_ as EVENTTYPE2_1_, events0_.ID_ as ID1_9_0_, events0_.EVENTTYPE_ as EVENTTYPE2_9_0_, events0_.TYPE_ as TYPE3_9_0_, events0_.GRAPHELEMENT_ as GRAPHELE4_9_0_ from JBPM_EVENT events0_ where events0_.PROCESSDEFINITION_=? Hibernate: select variablein0_.TASKINSTANCE_ as TASKINS16_1_, variablein0_.ID_ as ID1_1_, variablein0_.NAME_ as NAME4_1_, variablein0_.ID_ as ID1_27_0_, variablein0_.VERSION_ as VERSION3_27_0_, variablein0_.NAME_ as NAME4_27_0_, variablein0_.CONVERTER_ as CONVERTER5_27_0_, variablein0_.TOKEN_ as TOKEN6_27_0_, variablein0_.TOKENVARIABLEMAP_ as TOKENVAR7_27_0_, variablein0_.PROCESSINSTANCE_ as PROCESSI8_27_0_, variablein0_.BYTEARRAYVALUE_ as BYTEARRA9_27_0_, variablein0_.DATEVALUE_ as DATEVALUE10_27_0_, variablein0_.DOUBLEVALUE_ as DOUBLEV11_27_0_, variablein0_.LONGIDCLASS_ as LONGIDC12_27_0_, variablein0_.LONGVALUE_ as LONGVALUE13_27_0_, variablein0_.STRINGIDCLASS_ as STRINGI14_27_0_, variablein0_.STRINGVALUE_ as STRINGV15_27_0_, variablein0_.CLASS_ as CLASS2_27_0_ from JBPM_VARIABLEINSTANCE variablein0_ where variablein0_.TASKINSTANCE_=? Hibernate: select taskmgmtde0_.ID_ as ID1_18_0_, taskmgmtde0_.NAME_ as NAME3_18_0_, taskmgmtde0_.PROCESSDEFINITION_ as PROCESSD4_18_0_, taskmgmtde0_.STARTTASK_ as STARTTASK5_18_0_ from JBPM_MODULEDEFINITION taskmgmtde0_ where taskmgmtde0_.ID_=? and taskmgmtde0_.CLASS_='T' 16:12:45,796 DEBUG TaskInstance:477 - completion of task '受理' results in taking transition 'Transition(提交给初审)' 16:12:45,796 DEBUG GraphElement:165 - event 'before-signal' on 'TaskNode(受理)' for 'Token(/)' 16:12:45,796 DEBUG GraphElement:165 - event 'node-leave' on 'TaskNode(受理)' for 'Token(/)' 16:12:45,796 DEBUG GraphElement:165 - event 'transition' on 'Transition(提交给初审)' for 'Token(/)' Hibernate: select events0_.TRANSITION_ as TRANSITION7_1_, events0_.ID_ as ID1_1_, events0_.EVENTTYPE_ as EVENTTYPE2_1_, events0_.ID_ as ID1_9_0_, events0_.EVENTTYPE_ as EVENTTYPE2_9_0_, events0_.TYPE_ as TYPE3_9_0_, events0_.GRAPHELEMENT_ as GRAPHELE4_9_0_ from JBPM_EVENT events0_ where events0_.TRANSITION_=? Hibernate: select node0_.ID_ as ID1_7_0_, node0_.NAME_ as NAME3_7_0_, node0_.DESCRIPTION_ as DESCRIPT4_7_0_, node0_.PROCESSDEFINITION_ as PROCESSD5_7_0_, node0_.ISASYNC_ as ISASYNC6_7_0_, node0_.ISASYNCEXCL_ as ISASYNCE7_7_0_, node0_.ACTION_ as ACTION8_7_0_, node0_.SUPERSTATE_ as SUPERSTATE9_7_0_, node0_.SUBPROCNAME_ as SUBPROC10_7_0_, node0_.SUBPROCESSDEFINITION_ as SUBPROC11_7_0_, node0_.DECISIONEXPRESSION_ as DECISIO12_7_0_, node0_.DECISIONDELEGATION as DECISIO13_7_0_, node0_.SCRIPT_ as SCRIPT14_7_0_, node0_.SIGNAL_ as SIGNAL15_7_0_, node0_.CREATETASKS_ as CREATET16_7_0_, node0_.ENDTASKS_ as ENDTASKS17_7_0_, node0_.CLASS_ as CLASS2_7_0_ from JBPM_NODE node0_ where node0_.ID_=? 16:12:45,812 DEBUG GraphElement:165 - event 'node-enter' on 'TaskNode(初审)' for 'Token(/)' Hibernate: select events0_.NODE_ as NODE6_1_, events0_.ID_ as ID1_1_, events0_.EVENTTYPE_ as EVENTTYPE2_1_, events0_.ID_ as ID1_9_0_, events0_.EVENTTYPE_ as EVENTTYPE2_9_0_, events0_.TYPE_ as TYPE3_9_0_, events0_.GRAPHELEMENT_ as GRAPHELE4_9_0_ from JBPM_EVENT events0_ where events0_.NODE_=? Hibernate: select tasks0_.TASKNODE_ as TASKNODE13_1_, tasks0_.ID_ as ID1_1_, tasks0_.ID_ as ID1_16_0_, tasks0_.NAME_ as NAME2_16_0_, tasks0_.DESCRIPTION_ as DESCRIPT3_16_0_, tasks0_.PROCESSDEFINITION_ as PROCESSD4_16_0_, tasks0_.ISBLOCKING_ as ISBLOCKING5_16_0_, tasks0_.ISSIGNALLING_ as ISSIGNAL6_16_0_, tasks0_.CONDITION_ as CONDITION7_16_0_, tasks0_.DUEDATE_ as DUEDATE8_16_0_, tasks0_.PRIORITY_ as PRIORITY9_16_0_, tasks0_.ACTORIDEXPRESSION_ as ACTORID10_16_0_, tasks0_.POOLEDACTORSEXPRESSION_ as POOLEDA11_16_0_, tasks0_.TASKMGMTDEFINITION_ as TASKMGM12_16_0_, tasks0_.TASKNODE_ as TASKNODE13_16_0_, tasks0_.STARTSTATE_ as STARTSTATE14_16_0_, tasks0_.ASSIGNMENTDELEGATION_ as ASSIGNM15_16_0_, tasks0_.SWIMLANE_ as SWIMLANE16_16_0_, tasks0_.TASKCONTROLLER_ as TASKCON17_16_0_ from JBPM_TASK tasks0_ where tasks0_.TASKNODE_=? 16:12:45,828 WARN ProxyWarnLog:581 - Narrowing proxy to class org.jbpm.graph.node.TaskNode - this operation breaks == Hibernate: select hibernate_sequence.nextval from dual 16:12:45,890 DEBUG GraphElement:165 - event 'task-create' on 'Task(初审)' for 'Token(/)' Hibernate: select events0_.TASK_ as TASK8_1_, events0_.ID_ as ID1_1_, events0_.EVENTTYPE_ as EVENTTYPE2_1_, events0_.ID_ as ID1_9_0_, events0_.EVENTTYPE_ as EVENTTYPE2_9_0_, events0_.TYPE_ as TYPE3_9_0_, events0_.GRAPHELEMENT_ as GRAPHELE4_9_0_ from JBPM_EVENT events0_ where events0_.TASK_=? 16:12:45,968 DEBUG GraphElement:165 - event 'task-assign' on 'Task(初审)' for 'Token(/)' 16:12:45,968 DEBUG GraphElement:165 - event 'after-signal' on 'TaskNode(受理)' for 'Token(/)' TaskInstance.Token.Name end: Token(/) Node Name end:初审 |
|
liuzoe
2009-04-11
我已经解决了,流转业务以后.我update或者save任何一个动做的时候.就发出了hibernate的hql insert taskinstance语句.
虽然问题是解决了.可我还是很迷惑. 我是这么理解的,我再执行上面的方法以后,业务其实已经流转到下一个环节了,但是这时候我没有另开起一个事物,业务流转的hql语句在session中没有被发出,直到我外开启事物的时候,前面的语句才被发出.就好象session的flush一样. 但是如果我在业务流转以后不再需要持久化任何东西了.怎么样能将我的业务流转下去呢? 期待高人解惑.不胜感激.. |
|
mayanyun1986
2009-06-04
我跟你问题一样,期待中。。。
|
|
wcf109
2009-06-22
我有经验,是和你的事务有关的,如:<property name="transactionAttributes">
<props> <prop key="update*">PROPAGATION_REQUIRED</prop> <prop key="upd*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> <prop key="submit*">PROPAGATION_REQUIRED</prop> <prop key="*">PROPAGATION_REQUIRED, readOnly</prop> </props> </property> 这是你spring里的配置事务的,如果你的service里的方法名不是以你配置中的为开 头,就无法的往数据库里插入数据. 如你service里的方法名为:public void submitToWorkflow(String userId, String gongdId, String transitionName),所以你的spring配置文件里必须配置<prop key="submit*">PROPAGATION_REQUIRED</prop>,. |
|
hampster
2009-06-23
![]() |
|
tiger_wang
2009-11-18
我在配置事务的时候照楼上的方法做的 为什么还是不行呢?
|
|
hn.hb
2009-11-22
你没有关闭。
调用一下context.close();试试 |
|
云渊阁
2016-01-15
你这个JbpmContext怎么获取的啊?
|