Ashish Kumar [
https://community.jboss.org/people/ashish_kumar] created the discussion
"Re: How to save history of the process in a database"
To view the discussion, visit:
https://community.jboss.org/message/743031#743031
--------------------------------------------------------------
but now it is asking to define the getkbase function.So I manupulated the code.I am
sharing the entire cade.kindly look into it:
*package
*import
*import
*import
*import
*import
*import
***import
**
*import
*import
*import
*public
/***
**@param** args*/
**public** **static** **void** main(String[] args) **throws** Exception {
// **TODO** Auto-generated method stub*JBPMHelper.+startH2Server+();*
*JBPMHelper.+setupDataSource+();*
//EntityManagerFactory emf =
// Persistence.createEntityManagerFactory( "org.jbpm.persistence.jpa" );
***class** historyLog { *org.jbpm.test.JBPMHelper;
* org.jbpm.process.audit.JPAWorkingMemoryDbLogger;*
org.drools.runtime.StatefulKnowledgeSession;*
org.drools.persistence.jpa.JPAKnowledgeService;*org.drools.io.ResourceFactory;*org.drools.builder.ResourceType;*
org.drools.builder.KnowledgeBuilderFactory;* org.drools.builder.KnowledgeBuilder;*
org.drools.KnowledgeBaseFactory;* org.drools.KnowledgeBase;*sample;
*org.drools.runtime.Environment env = KnowledgeBaseFactory.+newEnvironment+();*
*KnowledgeBase kbase = +readKnowledgeBase+();*
//StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
//JPAWorkingMemoryDbLogger logger = new JPAWorkingMemoryDbLogger(ksession);
*StatefulKnowledgeSession ksession =
JPAKnowledgeService.+newStatefulKnowledgeSession+(kbase,*
*null**, env);**JPAWorkingMemoryDbLogger jbpmLogger =*
*new*
*JPAWorkingMemoryDbLogger(ksession);**ksession.startProcess(**"sample.bpmn.hh"**);*
// do stuff (start processes, etc...)
*jbpmLogger.dispose();*###
*//logger.dispose();
*
*}
**private** **static** KnowledgeBase readKnowledgeBase() **throws*** *Exception
{*KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.+newKnowledgeBuilder+();
kbuilder.add(ResourceFactory.+newClassPathResource+(
**"demo2.bpmn"), ResourceType.++BPMN2++**);***
*
***return*** *kbuilder.newKnowledgeBase();*}
}
**
Also on debugging this codesome error is comming like this:
**
*The jar of this file belongs to container 'JBPM Library' which does not allow
modifications to source attachments in its entries*.
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/743031#743031]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]