JBPM executionService.deleteProcessInstanceCascade(id)报错
JBPM版本4.3
代码:
。。。
ExecutionService executionService = processEngine.getExecutionService();
ProcessInstance pi = executionService.startProcessInstanceByKey("workflowXX");
String exId = pi.findActiveExecutionIn("XXState").getId();
executionService.signalExecutionById(exId);//抛出ORA-01722: 无效数字"异常
。。。
跟踪后发现时在执行jbpm.execution.hbm.xml文件中的命名查询findExecutionById时引发的异常,
最终生成的sql中将execution.id映射成了execution.dbId(生成sql的片段:where executioni0_.DBID_=?)
由于dbId是long型,而id是String型,所以导致了该异常。
<query name="findExecutionById">
<![CDATA[
select execution
from org.jbpm.pvm.internal.model.ExecutionImpl as execution
where execution.id = :id
]]>
</query>
<class name="ExecutionImpl"
table="JBPM4_EXECUTION"
discriminator-value="pvm">
<id name="dbid" column="DBID_">
<generator class="assigned" />
</id>
<discriminator><column name="CLASS_" /></discriminator>
<version name="dbversion" column="DBVERSION_" />
<property name="activityName" column="ACTIVITYNAME_" />
<property name="processDefinitionId" column="PROCDEFID_" />
<property name="hasVariables" column="HASVARS_" />
<map name="variables"
cascade="all-delete-orphan">
<key foreign-key="FK_VAR_EXECUTION">
<column name="EXECUTION_" index="IDX_VAR_EXECUTION"/>
</key>
<map-key type="string" column="KEY_" />
<one-to-many class="org.jbpm.pvm.internal.type.Variable" />
</map>
<map name="systemVariables"
cascade="all-delete-orphan">
<key foreign-key="FK_VAR_EXESYS">
<column name="EXESYS_" index="IDX_VAR_EXESYS"/>
</key>
<map-key type="string" column="KEY_" />
<one-to-many class="org.jbpm.pvm.internal.type.Variable" />
</map>
<property name="name" column="NAME_" />
<property name="key" column="KEY_" />
<property name="id" column="ID_" unique="true" />
试过删除对id属性的映射,发现都不会报错~~
<property name="state" column="STATE_" />
<property name="suspendHistoryState" column="SUSPHISTSTATE_" />
<property name="priority" column="PRIORITY_" />
<property name="historyActivityInstanceDbid" column="HISACTINST_" />
<list name="executions"
cascade="all-delete-orphan"
inverse="false"
lazy="false">
<key column="PARENT_" foreign-key="FK_EXEC_PARENT" />
<list-index column="PARENT_IDX_" />
<one-to-many class="ExecutionImpl" />
</list>
<map name="swimlanes"
cascade="all-delete-orphan">
<key foreign-key="FK_SWIMLANE_EXEC">
<column name="EXECUTION_" index="IDX_SWIMLANE_EXEC"/>
</key>
<map-key type="string" column="NAME_" />
<one-to-many class="org.jbpm.pvm.internal.task.SwimlaneImpl" />
</map>
<many-to-one name="parent"
column="PARENT_"
class="ExecutionImpl"
foreign-key="FK_EXEC_PARENT"
index="IDX_EXEC_PARENT"
lazy="false" />
<many-to-one name="processInstance"
class="ExecutionImpl"
column="INSTANCE_"
foreign-key="FK_EXEC_INSTANCE"
index="IDX_EXEC_INSTANCE"
lazy="false" />
<many-to-one name="superProcessExecution"
column="SUPEREXEC_"
class="ExecutionImpl"
foreign-key="FK_EXEC_SUPEREXEC"
index="IDX_EXEC_SUPEREXEC" />
<many-to-one name="subProcessInstance"
column="SUBPROCINST_"
class="ExecutionImpl"
foreign-key="FK_EXEC_SUBPI"
index="IDX_EXEC_SUBPI" />
</class>
这个问题是由于hibernate版本的问题导致的,使用jbpm包里面自带的hibernate后就没有问题了