6 Replies Latest reply on Jul 23, 2009 1:09 PM by kukeltje

    [JBPM4] deleteProcessInstanceCascade throw an exception due

    ronanker

      Hi,

      When I call deleteProcessInstanceCascade() have an exception due to the 'FK_HACTI_HPROCI' foreign key constraint.


      I'm wondering whether the jbpm.history.hbm.xml config file should have a "all-delete-orphan"

      <set name="historyActivityInstances"
       cascade="all-delete-orphan"> <!-- here, instead of 'all' -->
       <key foreign-key="FK_HACTI_HPROCI">
       <column name="HPROCI_" index="IDX_HACTI_HPROCI" />
       </key>
       <one-to-many class="HistoryActivityInstanceImpl" />
      </set>


      Notices i'm testing jBPM4 with mssql with is not supported yet. So, perhaps there is a link.

      I did not saw any jira related to this behavior.

      Let me know if i'm wrong or if this is a mssql-jBPM integration bug.

      Thanks.



        • 1. Re: [JBPM4] deleteProcessInstanceCascade throw an exception

          Can you post the error? is it parent key not found?

          • 2. Re: [JBPM4] deleteProcessInstanceCascade throw an exception
            kukeltje

            no jira issues related to foreign key constraint violations? Hmmmm...

            • 3. Re: [JBPM4] deleteProcessInstanceCascade throw an exception
              ronanker

              Here is the stacktrace:

              
              INFO [DefaultCommandService] - exception while executing command org.jbpm.pvm.internal.cmd.DeleteProcessInstance@169c398
              org.hibernate.exception.ConstraintViolationException: could not delete: [org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl#1]
               at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
               at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
               at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2559)
               at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2715)
               at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:97)
               at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
               at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
               at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:172)
               at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
               at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:64)
               at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:997)
               at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1142)
               at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
               at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:835)
               at org.jbpm.pvm.internal.hibernate.DbSessionImpl.findProcessInstanceByIdIgnoreSuspended(DbSessionImpl.java:208)
               at org.jbpm.pvm.internal.hibernate.DbSessionImpl.deleteProcessInstance(DbSessionImpl.java:248)
               at org.jbpm.pvm.internal.cmd.DeleteProcessInstance.execute(DeleteProcessInstance.java:49)
               at org.jbpm.pvm.internal.cmd.DeleteProcessInstance.execute(DeleteProcessInstance.java:31)
               at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
               at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:54)
               at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
               at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.deleteProcessInstanceCascade(ExecutionServiceImpl.java:124)
               at com.vc.mm.jbpm.JbpmTest.testJBPM(JbpmTest.java:107)
              ....
              Caused by: java.sql.SQLException: L'instruction DELETE est en conflit avec la contrainte REFERENCE 'FK_HACTI_HPROCI'. Le conflit s'est produit dans la base de données 'JBPM_TEST', table 'dbo.JBPM4_HIST_ACTINST', column 'HPROCI_'.
               at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:365)
              ...


              I also found the following thread in this forum:
              http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4242638#4242638

              But the given fix does not seem to be applied in the 4.0.0 GA.



              • 4. Re: [JBPM4] deleteProcessInstanceCascade throw an exception
                kukeltje

                but have you tried the 'fix'?

                • 5. Re: [JBPM4] deleteProcessInstanceCascade throw an exception
                  ronanker

                  I tried but without success.
                  I set the following code

                  cascade = "all-delete-orphan"

                  on-delete="cascade"

                  inverse="true"

                  on the "historyActivityInstances" set definition in the hbm.xml file in my jbpm.jar but it did not work. I don't undestand why.

                  On the other side, I also don't understand how it can work with the actual code (but I'm not a jBPM expert and there is perhaps something I missed).

                  Thanks for any clue.

                  • 6. Re: [JBPM4] deleteProcessInstanceCascade throw an exception
                    kukeltje

                    Maybe try a different version of the driver or a different dialect in hibernate