2 Replies Latest reply on Nov 9, 2013 5:32 PM by Marco Mechelli

    jBPM 6 not persisting processes with JPA

    Marco Mechelli Newbie



      i'm using jBPM 6.0.0.CR5 by embedding it in my web application (JBoss EAP 6.1, Oracle 11).


      I have a @Singleton EJB with @Asynchronous methods that handle all the threading for the processes.


      This EJB is using a PerProcessInstanceRuntimeManager to obtain RuntimeEngines. Environment is built as follows:


      RuntimeEnvironmentBuilder builder = RuntimeEnvironmentBuilder.getEmpty()
      .addConfiguration("drools.processSignalManagerFactory", DefaultSignalManagerFactory.class.getName())
      .addConfiguration("drools.processInstanceManagerFactory", DefaultProcessInstanceManagerFactory.class.getName())
      .addEnvironmentEntry(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);


      Now, my problem is that ProcessInstanceInfo does not seem to be persisted: whenever the process touches a Human Task and startProcess() returns, the transaction gets committed and i can see the sessioninfo and the workiteminfo on the database, but no processinstanceinfo.

      Hence, when i later complete the human task, the process does not resume execution.


      I must be missing something, but i just can't spot what!!


      Oh, and BTW i had to add the last EnviromentEntry because otherwise drools would throw ... is this a bug or intended behaviour?




        • 1. Re: jBPM 6 not persisting processes with JPA
          Maciej Swiderski Master

          Looks like you're bit mixing the usage of persistent and non persistent for the process engine and to be honest no idea what you're trying to achieve. If you would like to have non persistent process engine then that would not make sense to set entity manager. You could directly use RuntimeEnvironmentBuilder.getDefaultInMemory. That will provide you most of the elements configured for such usage. If you need persistence for process engine then use RuntimeEnvironmentBuilder.getDefault.


          the last environment entry should not be set when entity manager is already given to the RuntimeEnvironment. Could you provide stack trace that was thrown there?



          • 2. Re: jBPM 6 not persisting processes with JPA
            Marco Mechelli Newbie

            That did the trick, and i'm not getting any exceptions from drools ... i was definitely mis-configuring the environment.