1 2 Previous Next 18 Replies Latest reply on Aug 3, 2009 10:36 AM by Martin Weiler

    Failed to delete ProcessInstance due to foreign key constrai

    Tej jbpm Novice

      I am not able to delete a process instance. I found this JIRA entry but it does not resolve my issue

      https://jira.jboss.org/jira/browse/JBPM-2333

      My hibernate config is set to :
      org.hibernate.dialect.MySQLInnoDBDialect

      My Error message:

      Caused by: java.sql.BatchUpdateException: Cannot delete or update a parent row: a foreign key constraint fails (`psrdb`.`jbpm_node`, CONSTRAINT `fk_procst_sbprcdef` FOREIGN KEY (`subprocessdefinition_`) REFERENCES `jbpm_processdefinition` (`id_`))
      
       at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:665)
      
       at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
      
       at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
      


        • 1. Re: Failed to delete ProcessInstance due to foreign key cons
          Ronald van Kuijk Master

          is it an delete you do yourself? Or does it also happen when you just end a process the normal way? It is removed from te db then.

          • 2. Re: Failed to delete ProcessInstance due to foreign key cons
            Tej jbpm Novice

            it happens when i end an process..

            if it is removed from the db..why is it showing an error?

            • 3. Re: Failed to delete ProcessInstance due to foreign key cons
              Ronald van Kuijk Master

              because it cannot be removed due to e FK constraint.

              • 4. Re: Failed to delete ProcessInstance due to foreign key cons
                Tej jbpm Novice

                I can see that from the error..how do i fix that? It does not seem to be occuring from my code..but JBPM is failing to delete..so It is a bug..

                any fix or is it resolved?

                • 5. Re: Failed to delete ProcessInstance due to foreign key cons
                  Tej jbpm Novice

                  Ok this is happening when I have a "Process State" node in my process diagram..

                  • 6. Re: Failed to delete ProcessInstance due to foreign key cons
                    Martin Weiler Apprentice

                    TejJBPM, this is jBPM 3, right?

                    If you've got a process-state node in the process definition that you are trying to delete, you might want to try to delete the child process before. Although I have to say I don't see this FK violation in my environment (jBPM 3.2.5.SP5, MySQL 5.1.35, mysql-connector-java-5.0.7)

                    • 7. Re: Failed to delete ProcessInstance due to foreign key cons
                      Tej jbpm Novice

                      My JBPM Version is 3.2.1..

                      I tried to delete the child process and get this error:

                      Delete failed: An exception of type "org.hibernate.exception.ConstraintViolationException" was thrown. The message is: Could not execute JDBC batch update
                      2009-07-31 09:52:10,549 [http-80-Processor22] WARN (JDBCExceptionReporter.java:77) - SQL Error: 1451, SQLState: 23000
                      
                      2009-07-31 09:52:10,550 [http-80-Processor22] ERROR (JDBCExceptionReporter.java:78) - Cannot delete or update a parent row: a foreign key constraint fails (`bapsr`.`jbpm_node`, CONSTRAINT `fk_procst_sbprcdef` FOREIGN KEY (`subprocessdefinition_`) REFERENCES `jbpm_processdefinition` (`id_`))
                      
                      2009-07-31 09:52:10,550 [http-80-Processor22] ERROR (AbstractFlushingEventListener.java:301) - Could not synchronize database state with session
                      
                      org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
                      
                       at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
                      
                       at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
                      
                       at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
                      
                       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
                      
                       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:144)
                      
                       at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
                      
                       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
                      
                       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
                      
                       at org.jbpm.jsf.core.action.DeleteActionListener.handleAction(DeleteActionListener.java:50)
                      
                       at org.jbpm.jsf.core.impl.JbpmActionListenerWrapper.processAction(JbpmActionListenerWrapper.java:82)
                      
                       at javax.faces.event.ActionEvent.processListener(ActionEvent.java:77)
                      
                       at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:758)
                      
                       at javax.faces.component.UICommand.broadcast(UICommand.java:368)
                      
                       at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:186)
                      
                       at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:164)
                      
                       at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:352)
                      
                       at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
                      
                       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:248)
                      
                       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
                      
                       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                      
                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                      
                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                      
                       at com.njw.session.BASessionExpiryFilter.doFilter(BASessionExpiryFilter.java:43)
                      
                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                      
                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                      
                       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                      
                       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                      
                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                      
                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                      
                       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                      
                       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                      
                       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                      
                       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                      
                       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                      
                       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                      
                       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                      
                       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                      
                       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                      
                       at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
                      
                       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
                      
                       at java.lang.Thread.run(Thread.java:595)
                      
                      Caused by: java.sql.BatchUpdateException: Cannot delete or update a parent row: a foreign key constraint fails (`bapsr`.`jbpm_node`, CONSTRAINT `fk_procst_sbprcdef` FOREIGN KEY (`subprocessdefinition_`) REFERENCES `jbpm_processdefinition` (`id_`))
                      
                       at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:665)
                      
                       at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
                      
                       at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
                      


                      • 8. Re: Failed to delete ProcessInstance due to foreign key cons
                        Tej jbpm Novice

                        My MYSQL Version is 5.1 and MYSQL Connector version - 5.0.4 ..

                        any suggestions?

                        • 9. Re: Failed to delete ProcessInstance due to foreign key cons
                          Tej jbpm Novice

                          If I change the end state in the process-state to end ..I am able to delete but then the transition from the parent process to sub process is not happening...So i think there is some problem(or difference? ) in using end-state and end in the process-state? Any thoughts?

                          • 11. Re: Failed to delete ProcessInstance due to foreign key cons
                            Tej jbpm Novice

                            Sorry for being so dense....how do i use a connector?

                            • 14. Re: Failed to delete ProcessInstance due to foreign key cons
                              Martin Weiler Apprentice

                              I'd give a newer jBPM 3.2.x version a try

                              1 2 Previous Next