2 Replies Latest reply on Jul 6, 2009 2:24 PM by rams.rapol

    Deleting Process Throws Exception

    dhanushgopinath

      Hi,

      I am using jBPM 3.2 with jbpm bpel 1.1.1.GA.

      I am trying to delete a bpel process definition using the deleteProcessDefinition API on Grpah Session Object . This is my code for the delete

      
      graphSession = jbpmContext.getGraphSession();
      graphSession .deleteProcessDefinition(Long.parseLong(processDefId));


      But I am getting this exception while executing that API
      14:40:34,147 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: 23503
      14:40:34,147 ERROR [JDBCExceptionReporter] ERROR: update or delete on table "jbpm_token" violates foreign key constraint "fk_scopeinst_token" on table "bpel_scopeinstance"
       Detail: Key (id_)=(246) is still referenced from table "bpel_scopeinstance".
      14:40:34,147 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
      org.hibernate.exception.ConstraintViolationException: could not delete: [org.jbpm.graph.exe.Token#246]
       at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
       at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
       at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2541)
       at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2697)
       at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:74)
       at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)


      All the process instances are ended, in fact I only have one process instance and that is ended. Any Idea why this is happening. Do I need to do anything before calling the delete API?

      Thanks in Advance
      Regards