AnsweredAssumed Answered

SQLIntegrityConstraintViolationException when completing User task

Question asked by ganeshr on Mar 26, 2014
Latest reply on Mar 31, 2014 by trademak
Facing SQLIntegrityConstraintViolationException when completing the first user task in business process. Developed business process with two human task(both exclusive) and when completing the first task getting the below exception. Business process is simple start event -> user task1 -> user task2 -> end event.



26-Mar-2014[08:25:35.758]::DEBUG::listenerContainer-2::org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.deleteVariableInstance:47 - ooo Using Connection [Transaction-aware proxy for target Connection [jdbc:oracle:thin:@//DO4501.oracle.uprr.com:1521/DO45.uprr.com, UserName=DBPE999, Oracle JDBC driver]]
26-Mar-2014[08:25:35.758]::DEBUG::listenerContainer-2::org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.deleteVariableInstance:47 - ==>  Preparing: delete from ACT_RU_VARIABLE where ID_ = ? and REV_ = ?
26-Mar-2014[08:25:35.759]::DEBUG::listenerContainer-2::org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.deleteVariableInstance:47 - ==> Parameters: 16025359(String), 1(Integer)
26-Mar-2014[08:25:36.016]::DEBUG::listenerContainer-2::org.activiti.engine.impl.db.DbSqlSession:574 - executing: delete VariableInstanceEntity[id=16025403, name=TaskUpdatedBy, type=string, textValue=xprk821]
26-Mar-2014[08:25:36.017]::DEBUG::listenerContainer-2::org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.deleteVariableInstance:47 - ooo Using Connection [Transaction-aware proxy for target Connection [jdbc:oracle:thin:@//DO4501.oracle.uprr.com:1521/DO45.uprr.com, UserName=DBPE999, Oracle JDBC driver]]
26-Mar-2014[08:25:36.017]::DEBUG::listenerContainer-2::org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.deleteVariableInstance:47 - ==>  Preparing: delete from ACT_RU_VARIABLE where ID_ = ? and REV_ = ?
26-Mar-2014[08:25:36.017]::DEBUG::listenerContainer-2::org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.deleteVariableInstance:47 - ==> Parameters: 16025403(String), 1(Integer)
26-Mar-2014[08:25:36.275]::DEBUG::listenerContainer-2::org.activiti.engine.impl.db.DbSqlSession:574 - executing: delete Task[id=16025356, name=testCompletenessHumanTask]
26-Mar-2014[08:25:36.275]::DEBUG::listenerContainer-2::org.activiti.engine.impl.persistence.entity.TaskEntity.deleteTask:47 - ooo Using Connection [Transaction-aware proxy for target Connection [jdbc:oracle:thin:@//DO4501.oracle.uprr.com:1521/DO45.uprr.com, UserName=DBPE999, Oracle JDBC driver]]
26-Mar-2014[08:25:36.275]::DEBUG::listenerContainer-2::org.activiti.engine.impl.persistence.entity.TaskEntity.deleteTask:47 - ==>  Preparing: delete from ACT_RU_TASK where ID_ = ? and REV_ = ?
26-Mar-2014[08:25:36.276]::DEBUG::listenerContainer-2::org.activiti.engine.impl.persistence.entity.TaskEntity.deleteTask:47 - ==> Parameters: 16025356(String), 1(Integer)
26-Mar-2014[08:25:36.533]::DEBUG::listenerContainer-2::org.activiti.engine.impl.db.DbSqlSession:574 - executing: delete Execution[16025353]
26-Mar-2014[08:25:36.534]::DEBUG::listenerContainer-2::org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution:47 - ooo Using Connection [Transaction-aware proxy for target Connection [jdbc:oracle:thin:@//DO4501.oracle.uprr.com:1521/DO45.uprr.com, UserName=DBPE999, Oracle JDBC driver]]
26-Mar-2014[08:25:36.534]::DEBUG::listenerContainer-2::org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution:47 - ==>  Preparing: delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ?
26-Mar-2014[08:25:36.536]::DEBUG::listenerContainer-2::org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution:47 - ==> Parameters: 16025353(String), 1(Integer)
26-Mar-2014[08:25:37.105]::DEBUG::listenerContainer-2::org.activiti.engine.impl.interceptor.CommandContext:139 - Error while closing command context
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-02292: integrity constraint (BPE_ENPR.ACT_FK_VAR_EXE) violated - child record found

### The error may involve org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution-Inline
### The error occurred while setting parameters
### SQL: delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ?
### Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-02292: integrity constraint (BPE_ENPR.ACT_FK_VAR_EXE) violated - child record found

   at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:147)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.delete(DefaultSqlSession.java:158)
   at org.activiti.engine.impl.db.DbSqlSession$CheckedDeleteOperation.execute(DbSqlSession.java:227)
   at org.activiti.engine.impl.db.DbSqlSession.flushDeletes(DbSqlSession.java:575)
   at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:443)
   at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:169)
   at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:116)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:70)
   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:37)
   at org.activiti.engine.impl.FormServiceImpl.submitTaskFormData(FormServiceImpl.java:70)

When i changed the second human task to Async then first user task is getting completed and second user task is getting created. Not sure why this is happening.  I hope even in single transaction it should have the ability to complete the first user task and invoking next user task but that is not happening if done with exclusive.

Outcomes