2 Replies Latest reply on Jan 4, 2012 11:47 AM by Davor Stanic

    jBPM-console delete all persistence data in database on first startup

    Davor Stanic Newbie

      Hi,

       

       

      Scenario:

       

      Enviroment is configured for jBPM persistence , and we use H2 database.

       

      We create two process instance from the Main method of the Java class, and If we look in database

      for data in tables (PROCESSINSTANCEINFO,PROCESSINSTANCELOG,WORKITEMINFO ...) all data is properly recorded.

      On jbpm-console in process instance view all data is visible. 

       

      When we access jbpm-console for the first time after application server restart all data in database is erased.

       

       

       

       

      environment:

      -jboss-as-7.0.2.Final

      -jbpm-5.2.0.Final-bin

      -jbpm-5.2.0.Final-gwt-console

      -birt-runtime-3_7_0

      -designer-2.0-jboss7

      -guvnor-distribution-wars-5.3.1.Final

      -org.drools.updatesite-5.3.1.Final-assembly

       

      java code in main method:

       

      KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

      kbuilder.add(ResourceFactory.newUrlResource("http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST"),ResourceType.PKG);

      KnowledgeBase kbase = kbuilder.newKnowledgeBase();

                         

      JBPMHelper.setupDataSource();

                         

      EntityManagerFactory emf =   Persistence.createEntityManagerFactory( "org.jbpm.persistence.jpa");

      Environment env = KnowledgeBaseFactory.newEnvironment();

      env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );

                         

      StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env );

      JPAWorkingMemoryDbLogger logger = new JPAWorkingMemoryDbLogger(ksession);

      int sessionId = ksession.getId();

      System.out.println(sessionId);

       

      ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new CommandBasedWSHumanTaskHandler(ksession));

                         

      ksession.startProcess( "com.sample.bpmn.hello" );

       

      ksession.dispose();

      logger.dispose();

       

       

      Thanks

      Davor