0 Replies Latest reply on Feb 4, 2016 1:45 AM by Artem A

    jBPM Persistance

    Artem A Newbie

      Hi!

      I'm working on a jBPM project now and I can't get jBPM to persist its state into the DB. After I run a process, I see no records in the tables. I expect to see some records in processinstancelog, sessioninfo or nodeinstancelog tables, but there's none. I use PostgreSQL.

      persistence.xml:

      <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.domain" transaction-type="JTA">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jta-data-source>java:jboss/datasources/TestDS</jta-data-source>
        <mapping-file>META-INF/Taskorm.xml</mapping-file>
        <mapping-file>META-INF/JBPMorm.xml</mapping-file>
        <mapping-file>META-INF/Executor-orm.xml</mapping-file>
        <mapping-file>META-INF/Servicesorm.xml</mapping-file>
        <mapping-file>META-INF/TaskAuditorm.xml</mapping-file>

        <!-- engine -->
        <class>org.drools.persistence.info.SessionInfo</class>
        <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
        <class>org.drools.persistence.info.WorkItemInfo</class>
        <class>org.jbpm.persistence.correlation.CorrelationKeyInfo</class>
        <class>org.jbpm.persistence.correlation.CorrelationPropertyInfo</class>

        <!-- bam -->
        <class>org.jbpm.process.audit.ProcessInstanceLog</class>
        <class>org.jbpm.process.audit.NodeInstanceLog</class>
        <class>org.jbpm.process.audit.VariableInstanceLog</class>

        <properties>
        <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
        <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.id.new_generator_mappings" value="false"/>
        <property name="hibernate.transaction.jta.platform"
        value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform"/>
        </properties>
        </persistence-unit>

      </persistence>


      My Java method that invokes jBPM:

      public Response test() {
        KieServices kieServices = KieServices.Factory.get();
        KieContainer kContainer = kieServices.getKieClasspathContainer();
        KieBase kBase = kContainer.getKieBase();
        KieSession ksession = kBase.newKieSession();
        ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new WorkItemHandler() {
        @Override
        public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
        System.out.println("executeWorkItem done");
        }

        @Override
        public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
        System.out.println("abortWorkItem done");
        }
        });
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("name", "world");
        ProcessInstance proc = ksession.startProcess("test-project.sample", params);
        System.out.println("ID: " + proc.getId());
        return Response.status(200).entity("ok " + proc.getId()).build();
      }


      After I created the Test schema in DB and run the code, I see that it has created tables, but they all are empty.

      Tables in the schema