JBoss Community

where to set "update" in databaseschema

created by Thomas Colditz in jBPM - View the full discussion

Hi Community,

 

I simply want to setup jBPM with embedded H2 database. It works, that it isn't an inmem db. But everytime the engine is startet again, all content of db is overwritten.

 

I think the problem is an "create"-statement somewhere, where an "update" should be inserted. But I just dont know where...

Here's sample code:

public static void main(String[] args) {
        try {
            RuntimeManager manager = getRuntimeManager("processDefinition/simpleTestProcess.bpmn");        
            RuntimeEngine runtime = manager.getRuntimeEngine(EmptyContext.get());
            KieSession ksession = runtime.getKieSession();               
            ksession.startProcess("serviceTestProcess");
        } catch (Throwable t) {
            t.printStackTrace();
        }
    }
 
private static RuntimeManager getRuntimeManager(String process) {
        JBPMHelper.startH2Server();
        Properties properties = new Properties();
        PoolingDataSource pds = new PoolingDataSource();
        pds.setUniqueName(properties.getProperty("persistence.datasource.name", "jdbc/jbpm-ds"));
        pds.setClassName("bitronix.tm.resource.jdbc.lrc.LrcXADataSource");
        pds.setMaxPoolSize(5);
        pds.setAllowLocalTransactions(true);
        pds.getDriverProperties().put("user", properties.getProperty("persistence.datasource.user", "sa"));
        pds.getDriverProperties().put("password", properties.getProperty("persistence.datasource.password", "sa"));
        pds.getDriverProperties().put("url", properties.getProperty("persistence.datasource.url", "jdbc:h2:~/JBPM/process_jbpm;MVCC=TRUE"));
        pds.getDriverProperties().put("driverClassName", properties.getProperty("persistence.datasource.driverClassName", "org.h2.Driver"));
        pds.init();
 
        RuntimeEnvironment environment = RuntimeEnvironmentBuilder.getDefault()
            .addAsset(ResourceFactory.newClassPathResource(process), ResourceType.BPMN2)
            .get();
        return RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment);
    }

 

Please let me know, where/how to fix the problem.

 

With kind regards,

Tom

Reply to this message by going to Community

Start a new discussion in jBPM at Community