cancel
Showing results for 
Search instead for 
Did you mean: 

ActivitiRule allows multiple occurences of buisnesskey

billdoor
Champ in-the-making
Champ in-the-making
Hello,

long story short, i am unittesting a class and ran into unexpected behaivour, i extracted the point into a seperate test:

@Test (expected = IllegalArgumentException.class)
    @Deployment(resources  = {"test_process.bpmn"})
    public void startProcess_duplicateBkey() {
        rule.getRuntimeService().startProcessInstanceByKey("test_process", "a1");
        rule.getRuntimeService().startProcessInstanceByKey("test_process", "a1");

         System.out.println(rule.getRuntimeService().createProcessInstanceQuery().processInstanceBusinessKey("a1", "test_process").list().size());
    }


prints "2".

Why can i have 2 ProcessInstances of the same processdefinition with the same businesskey?
2 REPLIES 2

jbarrez
Star Contributor
Star Contributor
Yes, we changed that a long time ago. Many people complained about having a unique constraint on the business key, and rather it should be managed by the code calling the Activiti API. Also, the business key is often something like an id in another system, and the use case of having multiple processes for a certain object makes sense, often.

jbarrez
Star Contributor
Star Contributor
Of course, if you really need it, you can always add back the unique constraint on the database level.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.