Case Example Fails in Oracle

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

We run all our cmmn unit tests (https://github.com/flowable/flowable-engine/tree/master/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test) on all supported databases, including Oracle.

  • Which version of Oracle are you using?
  • Can you share your CMMN xml so we can try it ourselves?

We are using Oracle 12.1. Attached is my CMMN file which I cut and pasted from the example.

I tried to send my CMMN file, but it was rejected.

Not sure what the forum allows. Embedding the xml in a post works.
Alternatively, you can paste the contents in https://gist.github.com or any other such service.

Here is the gist link.

Thanks. I was (finally) able to test this against an Oracle 12.1, but for me the cmmn XML pasted above and the test code works fine without problems. After starting the case instance, the plan item instances are created as expected and no exception is being thrown.

Can you try this in a standalone unit test running against your oracle database?

i.e. in your test code above, have the following line too to deploy it:

cmmnRepositoryService.createDeployment().addClasspathResource(“my-case.cmmn.xml”).deploy();

Add these two lines to sample code and got the same error:

CmmnRepositoryService cmmnRepositoryService = cmmnEngine.getCmmnRepositoryService();
cmmnRepositoryService.createDeployment().addClasspathResource(“new-hire.cmmn.xml”).deploy();

Harry Smith

I wiped the database clean and them allowed “Schema Update” when building my JAVA CMMN Engine. That fixed the issue.