需求:撤回操作,把活动id为BuyConfirm撤回到WaitForUpdate
操作:
runtimeService.createChangeActivityStateBuilder()
/.moveExecutionsToSingleActivityId()
/.moveExecutionToActivityId()
/.moveActivityIdTo()
/.moveActivityIdToSubProcessInstanceActivityId()
/.moveActivityIdToParentActivityId()
/.moveActivityIdsToSingleActivityId()
.changeState();
bug:外键约束,撤回失败
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: "ACT_FK_EXE_PARENT: PUBLIC.ACT_RU_EXECUTION FOREIGN KEY(PARENT_ID_) REFERENCES PUBLIC.ACT_RU_EXECUTION(ID_) ('5fc082e7-e32f-11e8-bb37-34e12deba98d')"; SQL statement:
delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ? [23503-197]
### The error may involve org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl.deleteExecution-Inline
### The error occurred while setting parameters
### SQL: delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ?
### Cause: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: "ACT_FK_EXE_PARENT: PUBLIC.ACT_RU_EXECUTION FOREIGN KEY(PARENT_ID_) REFERENCES PUBLIC.ACT_RU_EXECUTION(ID_) ('5fc082e7-e32f-11e8-bb37-34e12deba98d')"; SQL statement:
delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ? [23503-197]
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) ~[mybatis-3.4.5.jar:3.4.5]
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:200) ~[mybatis-3.4.5.jar:3.4.5]
at org.apache.ibatis.session.defaults.DefaultSqlSession.delete(DefaultSqlSession.java:213) ~[mybatis-3.4.5.jar:3.4.5]
at org.flowable.common.engine.impl.db.DbSqlSession.flushDeleteEntities(DbSqlSession.java:566) ~[flowable-engine-common-6.3.1.jar:6.3.1]
at
原因:同一流程实例下还有一个执行对象(对应的activity为ConfrimTimer),外键指向被移动的方法BuyConfirm