cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot insert duplicate key

al_lv
Champ in-the-making
Champ in-the-making
Hallo,
I get this message afte runing my workflow.

Cannot insert duplicate key row in object 'ACT_RU_EXECUTION' with unique index 'ACT_UNIQ_RU_BUS_KEY'.

this a part of a staktrace:

INFO: Email task was succesfully completed.
14.07.2011 15:41:09 org.activiti.engine.impl.interceptor.CommandContext close
SCHWERWIEGEND: Error while closing command context
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: java.sql.SQLException: Cannot insert duplicate key row in object 'ACT_RU_EXECUTION' with unique index 'ACT_UNIQ_RU_BUS_KEY'.
### The error may involve org.activiti.engine.impl.persistence.entity.ExecutionEntity.insertExecution-Inline
### The error occurred while setting parameters
### Cause: java.sql.SQLException: Cannot insert duplicate key row in object 'ACT_RU_EXECUTION' with unique index 'ACT_UNIQ_RU_BUS_KEY'.
   at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:100)


I cann't understand what it wants and how can I fix it.
It happend with fresh builded database also.
I use activiti 5.6 and MsSQL.
Please help

Thanks

Alexej
12 REPLIES 12

jbarrez
Star Contributor
Star Contributor
How do I leave the current task from the Service Task Class?

See the docs: execution.leave().

create unique index ACT_UNIQ_HI_BUS_KEY on ACT_HI_PROCINST (PROC_DEF_ID_, BUSINESS_KEY_) where BUSINESS_KEY_ is not null;
may be the problem is PROC_DEF_ID_ in brackets. Should it be not PROC_INST_ID_ ?

We test internally on MSSQL and this problem has not popped up. How are you running the sql on your db?

al_lv
Champ in-the-making
Champ in-the-making
See the docs: execution.leave().
Oh! Thanks.
Then AbstractBpmnActivityBehavior should be extended. Isn't it?
The interface ActivityBehavior has no leave() Method.

How are you running the sql on your db?

I'm running ant db.create and get this message:
[java] 28.07.2011 11:48:19 org.activiti.engine.impl.db.DbSqlSession executeSchemaResource
[java] SCHWERWIEGEND: problem during schema create, statement 'create unique index ACT_UNIQ_RU_BUS_KEY on ACT_RU_EXECUTION (PROC_DEF_ID_, BUSINESS_KEY_) where BUSINESS_KEY_ is not null
[java] java.sql.SQLException: Incorrect syntax near the keyword 'where'.


I tried it without WHERE-Clause and it works….

jbarrez
Star Contributor
Star Contributor
The leave method is on the execution.