I’m using the example in the CMMN User’s Guild to build a working JAVA example. I have Oracle as my database. I used the Admin Console to deploy the Definition and then wrote some simple JAVA to create the instance. When I start the CaseInstance, I receive Constraint Violation.
Here is the Java snippet:
/ Configure Case Management Engine (Only DB Connection as of now) /
CmmnEngineConfiguration cfg = new StandaloneInMemCmmnEngineConfiguration();
cfg.setJdbcUrl(“jdbc:oracle:thin:@db1:2025/s2”)
.setJdbcUsername(“CCMUSER”)
.setJdbcPassword(“TEST!”)
.setJdbcDriver(“oracle.jdbc.driver.OracleDriver”)
// .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
;
CmmnEngine cmmnEngine = cfg.buildCmmnEngine();
CmmnRuntimeService cmmnRuntimeService = cmmnEngine.getCmmnRuntimeService();
CaseInstance caseInstance = cmmnRuntimeService.createCaseInstanceBuilder()
.caseDefinitionKey(“employeeOnboarding”)
.variable(“potentialEmployee”, “johnDoe”)
.start();
Here is the error:
Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-02291: integrity constraint (CCMUSER.ACT_FK_TSKASS_TASK) violated - parent key not found
The error may involve org.flowable.identitylink.service.impl.persistence.entity.IdentityLinkEntityImpl.bulkInsertIdentityLink-Inline
The error occurred while setting parameters
SQL: INSERT ALL into ACT_RU_IDENTITYLINK (ID_, REV_, TYPE_, USER_ID_, GROUP_ID_, TASK_ID_, PROC_INST_ID_, PROC_DEF_ID_, SCOPE_ID_, SCOPE_TYPE_, SCOPE_DEFINITION_ID_) VALUES (?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?) into ACT_RU_IDENTITYLINK (ID_, REV_, TYPE_, USER_ID_, GROUP_ID_, TASK_ID_, PROC_INST_ID_, PROC_DEF_ID_, SCOPE_ID_, SCOPE_TYPE_, SCOPE_DEFINITION_ID_) VALUES (?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?) into ACT_RU_IDENTITYLINK (ID_, REV_, TYPE_, USER_ID_, GROUP_ID_, TASK_ID_, PROC_INST_ID_, PROC_DEF_ID_, SCOPE_ID_, SCOPE_TYPE_, SCOPE_DEFINITION_ID_) VALUES (?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?) into ACT_RU_IDENTITYLINK (ID_, REV_, TYPE_, USER_ID_, GROUP_ID_, TASK_ID_, PROC_INST_ID_, PROC_DEF_ID_, SCOPE_ID_, SCOPE_TYPE_, SCOPE_DEFINITION_ID_) VALUES (?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?) SELECT * FROM dual
Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-02291: integrity constraint (CCMUSER.ACT_FK_TSKASS_TASK) violated - parent key not found
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:200)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185)
at org.flowable.common.engine.impl.db.DbSqlSession.flushBulkInsert(DbSqlSession.java:473)
at org.flowable.common.engine.impl.db.DbSqlSession.flushInsertEntities(DbSqlSession.java:429)
at org.flowable.common.engine.impl.db.DbSqlSession.flushInserts(DbSqlSession.java:406)
at org.flowable.common.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:291)
at org.flowable.common.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:191)
at org.flowable.common.engine.impl.interceptor.CommandContext.close(CommandContext.java:61)
at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:80)
at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:35)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51)
at org.flowable.cmmn.engine.impl.runtime.CmmnRuntimeServiceImpl.startCaseInstance(CmmnRuntimeServiceImpl.java:81)
at org.flowable.cmmn.engine.impl.runtime.CaseInstanceBuilderImpl.start(CaseInstanceBuilderImpl.java:165)
at com.medimpact.flowable.CaseManagement.main(CaseManagement.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-02291: integrity constraint (CCMUSER.ACT_FK_TSKASS_TASK) violated - parent key not found