cancel
Showing results for 
Search instead for 
Did you mean: 

Duplicate Business Key causing problems

prasanna_bits
Champ in-the-making
Champ in-the-making
Hi Community,

I have a situation where I have same business key for multiple instances of process definition. At any moment, a given business key will be with only one Active instance, after the instance has ended, there might be another instance created with the same business key.

When I try doing that I get the following which seems to suggest that there cannot be same business key for the same process_definition_id accross all instances. Did I read that right? It seems confusing the use of business key if this behavior is expected. Could you please explain a bit more on the use of it? Thanks a lot.

/Prasanna Rajaperumal
Cisco Systems

Could not start an instance of Process /_system/governance/workflows/cca/devline/templates/default. Error IOException org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: org.h2.jdbc.JdbcSQLException: Unique index or primary key violation: "ACT_UNIQ_HI_BUS_KEY_INDEX_8 ON PUBLIC.ACT_HI_PROCINST(PROC_DEF_ID_, BUSINESS_KEY_)"; SQL statement:
insert into ACT_HI_PROCINST (
        ID_,
        PROC_INST_ID_,
        BUSINESS_KEY_,
        PROC_DEF_ID_,
        START_TIME_,
        END_TIME_,
        DURATION_,
        START_USER_ID_,
        START_ACT_ID_,
        END_ACT_ID_
      ) values (
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?
      ) [23505-155]
   at org.h2.message.DbException.getJdbcSQLException(DbException.java:327)
   at org.h2.message.DbException.get(DbException.java:167)
   at org.h2.message.DbException.get(DbException.java:144)
   at org.h2.index.BaseIndex.getDuplicateKeyException(BaseIndex.java:80)
   at org.h2.index.PageBtree.find(PageBtree.java:121)
   at org.h2.index.PageBtreeLeaf.addRow(PageBtreeLeaf.java:146)
   at org.h2.index.PageBtreeLeaf.addRowTry(PageBtreeLeaf.java:100)
   at org.h2.index.PageBtreeIndex.addRow(PageBtreeIndex.java:93)
   at org.h2.index.PageBtreeIndex.add(PageBtreeIndex.java:84)
   at org.h2.table.RegularTable.addRow(RegularTable.java:127)
   at org.h2.command.dml.Insert.insertRows(Insert.java:124)
   at org.h2.command.dml.Insert.update(Insert.java:84)
   at org.h2.command.CommandContainer.update(CommandContainer.java:71)
   at org.h2.command.Command.executeUpdate(Command.java:212)
   at org.h2.server.TcpServerThread.process(TcpServerThread.java:300)
   at org.h2.server.TcpServerThread.run(TcpServerThread.java:137)
   at java.lang.Thread.run(Thread.java:680)
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
The business-key must be unique over ALL process-instances for a given process-definition, that includes RUNNING and FINISHED process instances. So the error you're getting makes sense…