JBoss Community

SessionInfo and ProcessInstanceInfo tables are not getting updated when starting the process using JPAKnoweldgeService

created by uvijayreddy657 in jBPM Development - View the full discussion

I am able to start the process and also able to store the TASK details. But SessionInfo, ProcessInstanceInfo and WorkItemInfo tables are not getting updated.

 

Queries are being generated only to insert data only into TASK and  PEOPLEASSIGNMENTS_POTOWNERS and PEOPLEASSIGNMENTS_BAS..etc tables. But not generating insert statements to SessionInfo and ProcessInstanceInfo tables.

 

Do we need to do any extra configurations or add extra statements to the code?

 

Please somebody help. I am  strucked with it from past 1 week.

 

Here is the piece of code which I am using to start the process.

 

>

> kbase = kbuilder.newKnowledgeBase();

>

>         Properties properties = new Properties();

>         properties.put("drools.processInstanceManagerFactory", "org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory") ;

>         properties.put("drools.processSignalManagerFactory","org.jbpm.persistence.processinstance.JPASignalManagerFactory");

>         KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);

>

>         Environment env = KnowledgeBaseFactory.newEnvironment();

>         env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);

>         env.set(EnvironmentName.GLOBALS, new MapGlobalResolver());

>         userTransaction = TransactionManagerServices.getTransactionManager();

>         env.set(EnvironmentName.TRANSACTION_MANAGER, userTransaction);

>         env.set(EnvironmentName.TRANSACTION, userTransaction);

>        

>         System.out.println("Loading session data ...");

>         if (ksession != null && Integer.valueOf(ksession.getId()) != null) {

>             try {

>             ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(ksession.getId(), kbase, config,env);

>             }catch (RuntimeException e) {

>                 if (e instanceof IllegalStateException) {

>                     Throwable cause = ((IllegalStateException) e).getCause();

>                     if (cause instanceof InvocationTargetException) {

>                         cause = cause.getCause();

>                         if (cause != null && ("Could not find session data for id "+ksession.getId()).equals(cause.getMessage())) {

>                             System.out.println("Creating new session data ...");                           

>                             ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, config, env);

>                         } else {

>                             System.err.println("Error loading session data: " + cause);

>                             throw e;

>                         }

>                     } else {

>                         System.err.println("Error loading session data:" + cause);

>                         throw e;

>                     }

>                 } else {

>                     System.err.println("Error loading session data: "  + e.getMessage());

>                     throw e;

>                 }

>             }

>         } else {

>             ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase,config, env);

>         }

>    

>         new WorkingMemoryDbLogger(ksession);

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

>

         // start the transaction

        UserTransaction ut = getUserTransaction();

         ut.begin();

>             ksession.startProcess(processId, params);

>

>             // commit the transaction

>             ut.commit();

Reply to this message by going to Community

Start a new discussion in jBPM Development at Community