Unique Key Violation on PUBLIC.ORGANIZATIONALENTITY when running processes concurrently

Solution Verified - Updated -

Issue

When running processes concurrently, for example, by using this code:

                ExecutorService exec = Executors.newCachedThreadPool();
                exec.submit(new Runnable(){
                        @Override
                        public void run() {
                                // start a new process instance
                                ProcessInstance proc = ksession.startProcess("com.example.bpms.simplesupplyitemapproval", params);
        });
                exec.submit(new Runnable(){
                        @Override
                        public void run() {
                                // start a new process instance
                                ProcessInstance proc = ksession.startProcess("com.example.bpms.simplesupplyitemapproval", params); 
                        }
        });

It ends with following exception:

ERROR: Unique index or primary key violation: "PRIMARY_KEY_C6 ON PUBLIC.ORGANIZATIONALENTITY(ID)"; SQL statement:
insert into OrganizationalEntity (DTYPE, id) values ('User', ?) [23505-168]

However, if the threads are removed and simply invoke the process twice using new Runtime engines, it will work.

What would cause this Primary Key Exception?

Environment

  • Red Hat JBoss BPMS
    • 6.0.x
    • 6.1.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.