AnsweredAssumed Answered

Updating the database from JavaDelegate

Question asked by rodiaz on Sep 26, 2012
Latest reply on Sep 27, 2012 by frederikheremans1
Hi all,

I don't know if there is a way to do what I want…
I have an async service task for executing several commands configured by the user. For example: create new file, copy, or delete a file…
If one of the commands fails in execution I throw a exception, but when the task is restarted I need to know what commands were successful because I don want executing them again.
I tried to do this setting a variable with my command identifier in my DelegateExecution with boolean value. But I noticed that this variable is not really stored until the execution is ended. So, if the execution is interrupted I never has that variable.
So, I tried as well to set it calling a rest service from my JavaDelagate that make it through RuntimeService

runtimeService.setVariable(executionId, variableName, value);

Now I can see that the database is updated but when the service task execution ends I get the error

Exception in thread "pool-2-thread-3" org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-02292: restricci?n de integridad (IBAP8.ACT_FK_VAR_EXE) violada - registro secundario encontrado

And the thread continues alive…

There is a way to do what I want??

Thanks in advance