7 Replies Latest reply on Oct 21, 2011 6:20 PM by salaboy21

    jBPM Process Persistence Issue

    trjiii

      I am currently using jBPM 5.1 within Websphere and am having problems with my persisting the ProcessInstanceInfo.  I am seeing the processinformation bing persisted but after the process has completed, the date fields(lastModificationDate, etc) are null and the state is still set to 0 even though the process has completed.  I am sure I am missing something obvious.

       

      Any ideas as to what to look for?

       

      Thanks

      Thomas

        • 1. Re: jBPM Process Persistence Issue
          vmdocua

          Hello Thomas,

           

          This might be problem related to JBPM5 persistence mechanism design, things like ProcessInstanecInfo, WorkItemInfo serialized automatically by JPA. On long transaction it's possible that JPA+Hibernate flushes objects from JBPM session to  DB and mark this object as pesisted. Then JBPM code still continue to modify objects (process info, workitem info, logs etc), but these updates don't affect JPA session, so applying to JPA this object is not modified anymore. This is caused by specific design/implementation for presistance in JBPM.

           

          If this is case - as temporary solution provide own EntityManagerFactory implementation and for each created EntityManager set "EntityManager.setFlushMode(FlushModeType.COMMIT)". This will prevent intermediate flushes and delay all JBPM/JPA persistence to DB calls to transaction commit time. 

           

          --

          Thanks,

          Vadim.

          • 2. Re: jBPM Process Persistence Issue
            marco.rietveld

            Which database are you using? (or are you just using the defaul h2 configuration?)

            • 3. Re: jBPM Process Persistence Issue
              vmdocua

              Hello Marco,

               

              I belive mentioned problem is not related to DB at all and should exist on many DBs. We saw this on DB2 UDB 9.  Problem roots reside in JPBM5 persistence mechanism design, it should be reviewed and reworked, palliative solution to bypass this provided above. ORM works with entities like processinstanceinfo (XXXinfo), but there is no correlation between real process runtime info and serialized XXXinfo. Once XXXinfo is serialized by ORM,  it will not be serialized anymore even if related process was updated. In 90-99% cases nobody see this problem, as in JBPM5 demo, presentation and tutorial code transaction is simple and commit happens at the end, when all JBPM5 execution finished and all is good. In  real business application and large transaction it's possible that Hibernate sometime flushes data to DB  in the middle of JTA transaction. This intermediate snapshot will contain old/broken information about process instance. Later, at the JTA transaction commit time latest process instance information will not be serialized to DB anymore.

               

              --

              Thanks,

              Vadim.

              • 4. Re: jBPM Process Persistence Issue
                trjiii

                I am experiencing this problem on DB2 express currently.

                • 5. Re: jBPM Process Persistence Issue
                  trjiii

                  Thanks Vadim!  I will give this a try and see if it helps this problem.  Thanks again for the information!

                  • 6. Re: jBPM Process Persistence Issue
                    trjiii

                    I figured this out.  Had to remove the TransactionFactory_factory property from Hibernate and also wrap in  a userTransaction.begin() and .Commit()

                    • 7. Re: jBPM Process Persistence Issue
                      salaboy21

                      hmm instead of doing that you should configure with hibernate the transaction manager provided by websphere if not you are doing something that it should be a container responsability. Of course that it will work but be ready for complications in the future.

                      Cheers