cancel
Showing results for 
Search instead for 
Did you mean: 

process does not wait at the user task ; FK constraint error

sapra
Champ in-the-making
Champ in-the-making
I have a user task –> java service task –> user task –> java service task –> end.

when the process hit the user task, it used to go into the wait state.
I was using spring beans for the java service task.

Now I changed the java service tasks to implement ActivityBehavior.
After this change, the process waits at the 1st user task and when it is complete, it goes to the second user task [create the task in db] but instead of waiting, it continues and ends. At that time, it tries to delete the execution record but fails due to FK from the second task record into the execution.

Why does it not wait at the second user task. It used to when my service tasks were spring beans [without implementing either javaDelegate or ActivityBehavior ].

Appreciate any help.
thanks
Saprar
4 REPLIES 4

sapra
Champ in-the-making
Champ in-the-making
I attached the process diagram.

the exception is :
### Error updating database.  Cause: org.postgresql.util.PSQLException: ERROR: update or delete on table "act_ru_execution" violates foreign key constraint "act_fk_task_exe" on table "act_ru_task"
  Detail: Key (id_)=(412) is still referenced from table "act_ru_task".
### The error may involve org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution-Inline
### The error occurred while setting parameters
### Cause: org.postgresql.util.PSQLException: ERROR: update or delete on table "act_ru_execution" violates foreign key constraint "act_fk_task_exe" on table "act_ru_task"
  Detail: Key (id_)=(412) is still referenced from table "act_ru_task".
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:120)
at org.apache.ibatis.session.defaults.DefaultSqlSession.delete(DefaultSqlSession.java:131)
at org.activiti.engine.impl.db.DbSqlSession$DeleteById.execute(DbSqlSession.java:146)
at org.activiti.engine.impl.db.DbSqlSession.flushDeletes(DbSqlSession.java:444)
at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:349)
at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:147)
at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:103)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:49)
at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)

mindcrime
Champ in-the-making
Champ in-the-making
This sound VERY similar to the problem I'm having.  For reference, here's the post about my scenario:
http://forums.activiti.org/en/viewtopic.php?f=6&t=6151&start=0

trademak
Star Contributor
Star Contributor
Hi,

Would it be possible to create a small unit test project that shows this error?
You can sent it to tijs.rademakers AT gmail.com and then I'll have a look at it.

Best regards,

frederikherema1
Star Contributor
Star Contributor
Please note, the ActivityBehaviour approach is advanced and the behaviors actually control the process-flows whereas JavaDelegates are only called to perform an action, without affecting process-flow.