# Case Example Fails in Oracle

**URL:** <https://forum.flowable.org/t/case-example-fails-in-oracle/3451>\
**Category:** Flowable Engine\
**Created:** [February 14, 2019, 5:05pm UTC](https://forum.flowable.org/t/case-example-fails-in-oracle/3451 "2019-02-14T17:05:53Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![hsmith](https://avatars.discourse-cdn.com/v4/letter/h/bc79bd/32.png) [@hsmith](https://forum.flowable.org/u/hsmith)\
**Post date:** [February 14, 2019, 5:05pm UTC](https://forum.flowable.org/t/case-example-fails-in-oracle/3451/1 "2019-02-14T17:05:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![joram](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joram/32/26_2.png) [@joram](https://forum.flowable.org/u/joram)\
**Post date:** [February 15, 2019, 8:36am UTC](https://forum.flowable.org/t/case-example-fails-in-oracle/3451/2 "2019-02-15T08:36:06Z")

</div>

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](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?

---

<div class="post-metadata">

**Author:** ![hsmith](https://avatars.discourse-cdn.com/v4/letter/h/bc79bd/32.png) [@hsmith](https://forum.flowable.org/u/hsmith)\
**Post date:** [February 15, 2019, 3:50pm UTC](https://forum.flowable.org/t/case-example-fails-in-oracle/3451/3 "2019-02-15T15:50:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hsmith](https://avatars.discourse-cdn.com/v4/letter/h/bc79bd/32.png) [@hsmith](https://forum.flowable.org/u/hsmith)\
**Post date:** [February 15, 2019, 3:52pm UTC](https://forum.flowable.org/t/case-example-fails-in-oracle/3451/4 "2019-02-15T15:52:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![joram](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joram/32/26_2.png) [@joram](https://forum.flowable.org/u/joram)\
**Post date:** [February 15, 2019, 3:54pm UTC](https://forum.flowable.org/t/case-example-fails-in-oracle/3451/5 "2019-02-15T15:54:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hsmith](https://avatars.discourse-cdn.com/v4/letter/h/bc79bd/32.png) [@hsmith](https://forum.flowable.org/u/hsmith)\
**Post date:** [February 15, 2019, 4:35pm UTC](https://forum.flowable.org/t/case-example-fails-in-oracle/3451/6 "2019-02-15T16:35:01Z")

</div>

Here is the gist link.

> <https://gist.github.com/mihsmith/c75594fd40040fcaa61e61b3e378aeee>

---

<div class="post-metadata">

**Author:** ![joram](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joram/32/26_2.png) [@joram](https://forum.flowable.org/u/joram)\
**Post date:** [February 19, 2019, 2:00pm UTC](https://forum.flowable.org/t/case-example-fails-in-oracle/3451/7 "2019-02-19T14:00:41Z")

</div>

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();

---

<div class="post-metadata">

**Author:** ![hsmith](https://avatars.discourse-cdn.com/v4/letter/h/bc79bd/32.png) [@hsmith](https://forum.flowable.org/u/hsmith)\
**Post date:** [February 19, 2019, 8:52pm UTC](https://forum.flowable.org/t/case-example-fails-in-oracle/3451/8 "2019-02-19T20:52:53Z")

</div>

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**

---

<div class="post-metadata">

**Author:** ![hsmith](https://avatars.discourse-cdn.com/v4/letter/h/bc79bd/32.png) [@hsmith](https://forum.flowable.org/u/hsmith)\
**Post date:** [February 25, 2019, 5:37pm UTC](https://forum.flowable.org/t/case-example-fails-in-oracle/3451/9 "2019-02-25T17:37:06Z")

</div>

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