10 Replies Latest reply on Aug 30, 2013 12:00 PM by swiderski.maciej

    Why is ProcessInstanceInfo emptied after process ends?

    lauradp

      Hello everybody,

      I succeeded in filling jbpm5 ProcessInstanceInfo table while process is running, but when process ends the db record is deleted.

      When a new process is created, its processId is correctly different from its predecessors.

      Is this the expected behaviour? I was expecting to have these data permanently stored in ProcessInstanceInfo  table!

       

      Here's my persistence.xml:

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

      <persistence version="2.0"

         xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="

              http://java.sun.com/xml/ns/persistence

              http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

             

        <persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA">

         

          <jta-data-source>java:/jdbc/jbpm-ds</jta-data-source>

         

          <mapping-file>META-INF/JBPMorm-JPA2.xml</mapping-file>

       

                <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>

                <class>org.jbpm.persistence.processinstance.ProcessInstanceLog</class>

          <class>org.drools.persistence.info.SessionInfo</class>

          <class>org.drools.persistence.info.WorkItemInfo</class>

       

                <properties>

            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>  

            <property name="hibernate.hbm2ddl.auto" value="update" />      

          </properties>

        </persistence-unit>

       

        <persistence-unit name="org.jbpm.task">

                <provider>org.hibernate.ejb.HibernatePersistence</provider>

                <mapping-file>META-INF/Taskorm-JPA2.xml</mapping-file>

       

                <class>org.jbpm.task.Attachment</class>

          <class>org.jbpm.task.Content</class>

          <class>org.jbpm.task.BooleanExpression</class>

          <class>org.jbpm.task.Comment</class>

          <class>org.jbpm.task.Deadline</class>

          <class>org.jbpm.task.Comment</class>

          <class>org.jbpm.task.Deadline</class>

          <class>org.jbpm.task.Delegation</class>

          <class>org.jbpm.task.Escalation</class>

          <class>org.jbpm.task.Group</class>

          <class>org.jbpm.task.I18NText</class>

          <class>org.jbpm.task.Notification</class>

          <class>org.jbpm.task.EmailNotification</class>

          <class>org.jbpm.task.EmailNotificationHeader</class>

          <class>org.jbpm.task.PeopleAssignments</class>

          <class>org.jbpm.task.Reassignment</class>

          <class>org.jbpm.task.Status</class>

          <class>org.jbpm.task.Task</class>

          <class>org.jbpm.task.TaskData</class>

          <class>org.jbpm.task.SubTasksStrategy</class>

          <class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>

          <class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>

          <class>org.jbpm.task.User</class>

       

                <properties>

            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>         

            <property name="hibernate.max_fetch_depth" value="3"/>

            <property name="hibernate.hbm2ddl.auto" value="update" />

            <property name="hibernate.show_sql" value="false" /> 

            <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />

            <property name="hibernate.id.new_generator_mappings" value="false" />

          </properties>

        </persistence-unit>

      </persistence>

       

      Laura

        • 1. Re: Why is ProcessInstanceInfo emptied after process ends?
          cdsosi

          Hi Laura,

           

          I am not jBPM expert but I think this is normal behaviour. To my opinion ProcessInstanceInfo is for current active processes.

          You have a second DB Table named ProcessIntanceLog that keeps trace of processes (active processes have start date only and terminated ones both start and end date specified).

           

          HTH

          • 2. Re: Why is ProcessInstanceInfo emptied after process ends?
            lauradp

            Hi Franck

            I have ProcessInstanceLog table, but this table is always empty!

            • 3. Re: Why is ProcessInstanceInfo emptied after process ends?
              cdsosi

              This is strange, I have just made a small test with "Evaluation" process bundled with jBPM, here are the results with only the 1st step of the process (start process and input values in the form).

              >>

              select * from processinstancelog;

              id |        end_date         | outcome | parentprocessinstanceid |       processid       | processinstanceid |       start_date        | status

              ----+-------------------------+---------+-------------------------+-----------------------+-------------------+-------------------------+--------

                1 | 2013-01-02 16:53:00.519 |         |                      -1 | com.sample.evaluation |                 1 | 2013-01-02 16:21:53.245 |      2

                2 |                         |         |                      -1 | com.sample.evaluation |                 2 | 2013-01-02 18:20:37.303 |      0

               

              select * from processinstanceinfo;

              instanceid | id |  lastmodificationdate   |      lastreaddate       |       processid       | processinstancebytearray |        startdate        | state | optlock

              ------------+----+-------------------------+-------------------------+-----------------------+--------------------------+-------------------------+-------+---------

                        2 |  2 | 2013-01-02 18:20:37.352 | 2013-01-02 18:20:39.155 | com.sample.evaluation |                  1067759 | 2013-01-02 18:20:37.299 |     1 |       3

               

              >>

               

              To have better visualization paste text between >> in a text editor. As you can see instance id number 2 has no end date in ProcessInstanceLog.

               

              I have no idea why your ProcessInstanceLog table is always empty...

               

              Franck

              • 4. Re: Why is ProcessInstanceInfo emptied after process ends?
                swiderski.maciej

                Laura, please make sure that you register JPAWorkingMemoryDBLogger on the ksession otherwise data are not persisted since there is no listener that can do so.

                 

                new JPAWorkingMemoryDbLogger(ksession)

                 

                 

                HTH

                • 5. Re: Why is ProcessInstanceInfo emptied after process ends?
                  lauradp

                  Thanks!

                  Should I dispose the logger after process ends? how can I do that?

                  • 6. Re: Why is ProcessInstanceInfo emptied after process ends?
                    swiderski.maciej

                    this logger should be active as long as session is active.

                     

                    HTH

                    1 of 1 people found this helpful
                    • 7. Re: Why is ProcessInstanceInfo emptied after process ends?
                      lauradp

                      So you mean that when session dies, the logger is dismissed!

                      • 8. Re: Why is ProcessInstanceInfo emptied after process ends?
                        swiderski.maciej

                        correct, it will be only active for the session it was registered for. As far as I remember the dispose method of that logger does nothing so there is no need to do any special clean up here.

                         

                        HTH

                        • 9. Re: Why is ProcessInstanceInfo emptied after process ends?
                          complexgg


                          Hi Maciej,

                          I have the same situation like this .I have registered the  JPA DB Logger on  session as your suggestion. but the problem is not solved.

                           

                          workflow is the evalution flow.

                          my situation:

                          1.once the HumanTask Node is completed ,the record in table workItemInfo will be deleted

                          2.once the process end,the record in table processInstanceInfo will be deleted ,but the processInstanceinfolog will keep the record.

                          I can see the delete SQL in log.

                          How can i avoid deleting the records in processinstanceinfo and workiteminfo?

                           

                          Regards

                          • 10. Re: Why is ProcessInstanceInfo emptied after process ends?
                            swiderski.maciej

                            This is how it should behave. Runtime data are only kept for the life time of the process instance and once completed will be removed. Similar for workiteminfo as soon as workitem is completed it will be removed from runtime data base. Enabling history log will give you pretty much everything that is important. Moreover if need to capture more data you can either extend default history log listener or create a custom one.

                             

                            HTH