Discussion:
[jboss-user] [jBPM] - Why is ProcessInstanceInfo emptied after process ends?
Laura delli Paoli
2013-01-02 16:22:26 UTC
Permalink
Laura delli Paoli [https://community.jboss.org/people/lauradp] created the discussion

"Why is ProcessInstanceInfo emptied after process ends?"

To view the discussion, visit: https://community.jboss.org/message/787095#787095

--------------------------------------------------------------
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 http://java.sun.com/xml/ns/persistence" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="
        http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence
        http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd 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
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/787095#787095]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Franck cdsosi
2013-01-02 17:08:09 UTC
Permalink
Franck cdsosi [https://community.jboss.org/people/cdsosi] created the discussion

"Re: Why is ProcessInstanceInfo emptied after process ends?"

To view the discussion, visit: https://community.jboss.org/message/787106#787106

--------------------------------------------------------------
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
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/787106#787106]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Laura delli Paoli
2013-01-02 17:13:15 UTC
Permalink
Laura delli Paoli [https://community.jboss.org/people/lauradp] created the discussion

"Re: Why is ProcessInstanceInfo emptied after process ends?"

To view the discussion, visit: https://community.jboss.org/message/787107#787107

--------------------------------------------------------------
Hi Franck
I have ProcessInstanceLog table, but this table is always empty!
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/787107#787107]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Franck cdsosi
2013-01-02 17:38:24 UTC
Permalink
Franck cdsosi [https://community.jboss.org/people/cdsosi] created the discussion

"Re: Why is ProcessInstanceInfo emptied after process ends?"

To view the discussion, visit: https://community.jboss.org/message/787112#787112

--------------------------------------------------------------
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
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/787112#787112]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2013-01-03 10:15:21 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Why is ProcessInstanceInfo emptied after process ends?"

To view the discussion, visit: https://community.jboss.org/message/787285#787285

--------------------------------------------------------------
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
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/787285#787285]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Laura delli Paoli
2013-01-03 14:21:12 UTC
Permalink
Laura delli Paoli [https://community.jboss.org/people/lauradp] created the discussion

"Re: Why is ProcessInstanceInfo emptied after process ends?"

To view the discussion, visit: https://community.jboss.org/message/787341#787341

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

Reply to this message by going to Community
[https://community.jboss.org/message/787341#787341]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2013-01-03 15:52:43 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Why is ProcessInstanceInfo emptied after process ends?"

To view the discussion, visit: https://community.jboss.org/message/787369#787369

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

HTH
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/787369#787369]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Laura delli Paoli
2013-01-03 16:22:12 UTC
Permalink
Laura delli Paoli [https://community.jboss.org/people/lauradp] created the discussion

"Re: Why is ProcessInstanceInfo emptied after process ends?"

To view the discussion, visit: https://community.jboss.org/message/787379#787379

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

Reply to this message by going to Community
[https://community.jboss.org/message/787379#787379]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2013-01-03 16:57:50 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Why is ProcessInstanceInfo emptied after process ends?"

To view the discussion, visit: https://community.jboss.org/message/787386#787386

--------------------------------------------------------------
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
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/787386#787386]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...