sapra (14) [Avatar] Offline
#1
Hi,
can anyone please give me a hint why the process does not wait at the second userask.

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 ].


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:smilie
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)
tijs.rademakers (494) [Avatar] Offline
#2
Re: process does not wait at the user task ; FK constraint error
Hi,

Did you read about the special behavior of the ActivitiBehavior usage?
You have to explicity leave the task like:

execution.take(transition);

Best regards,

Tijs
sapra (14) [Avatar] Offline
#3
Re: process does not wait at the user task ; FK constraint error
thanks Tijs.

I did handle the out going transition as you explained in your book.

I get the correct transition and do a "take" on it.
execution.take(transition);

I see the following in the log :
Mar 4, 2012 8:19:58 PM org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior performOutgoingBehavior
FINE: Leaving activity 'usertask1'

and when the task was not implementing AB , I see the following
FINEST: loaded object 'ProcessDefinitionEntity[createsomething_wf:2:810]' was not updated
Mar 4, 2012 8:41:12 PM org.activiti.engine.impl.db.DbSqlSession flush[/b]
tijs.rademakers (494) [Avatar] Offline
#4
Re: process does not wait at the user task ; FK constraint error
Hi,

Can you send me the project with a unit test that shows the error?
You can send it to tijs.rademakers@gmail.com

Thanks,

Tijs