<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    where to set "update" in databaseschema
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/fellowtom">Thomas Colditz</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/832618#832618">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi Community,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I think the problem is an "create"-statement somewhere, where an "update" should be inserted. But I just dont know where...</p><p>Here's sample code:</p><pre class="jive-pre"><code class="jive-code jive-java"><font color="navy"><b>public</b></font> <font color="navy"><b>static</b></font> <font color="navy"><b>void</b></font> main(String[] args) <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>try</b></font> <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; RuntimeManager manager = getRuntimeManager(<font color="red">"processDefinition/simpleTestProcess.bpmn"</font>);&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; RuntimeEngine runtime = manager.getRuntimeEngine(EmptyContext.get());
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; KieSession ksession = runtime.getKieSession();&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ksession.startProcess(<font color="red">"serviceTestProcess"</font>);
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font> <font color="navy"><b>catch</b></font> (Throwable t) <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; t.printStackTrace();
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font>
&#160;&#160;&#160; <font color="navy">}</font>
&#160;
<font color="navy"><b>private</b></font> <font color="navy"><b>static</b></font> RuntimeManager getRuntimeManager(String process) <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; JBPMHelper.startH2Server();
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Properties properties = <font color="navy"><b>new</b></font> Properties();
&#160;&#160;&#160;&#160;&#160;&#160;&#160; PoolingDataSource pds = <font color="navy"><b>new</b></font> PoolingDataSource();
&#160;&#160;&#160;&#160;&#160;&#160;&#160; pds.setUniqueName(properties.getProperty(<font color="red">"persistence.datasource.name"</font>, <font color="red">"jdbc/jbpm-ds"</font>));
&#160;&#160;&#160;&#160;&#160;&#160;&#160; pds.setClassName(<font color="red">"bitronix.tm.resource.jdbc.lrc.LrcXADataSource"</font>);
&#160;&#160;&#160;&#160;&#160;&#160;&#160; pds.setMaxPoolSize(5);
&#160;&#160;&#160;&#160;&#160;&#160;&#160; pds.setAllowLocalTransactions(<font color="navy"><b>true</b></font>);
&#160;&#160;&#160;&#160;&#160;&#160;&#160; pds.getDriverProperties().put(<font color="red">"user"</font>, properties.getProperty(<font color="red">"persistence.datasource.user"</font>, <font color="red">"sa"</font>));
&#160;&#160;&#160;&#160;&#160;&#160;&#160; pds.getDriverProperties().put(<font color="red">"password"</font>, properties.getProperty(<font color="red">"persistence.datasource.password"</font>, <font color="red">"sa"</font>));
&#160;&#160;&#160;&#160;&#160;&#160;&#160; pds.getDriverProperties().put(<font color="red">"url"</font>, properties.getProperty(<font color="red">"persistence.datasource.url"</font>, <font color="red">"jdbc:h2:~/JBPM/process_jbpm;MVCC=TRUE"</font>));
&#160;&#160;&#160;&#160;&#160;&#160;&#160; pds.getDriverProperties().put(<font color="red">"driverClassName"</font>, properties.getProperty(<font color="red">"persistence.datasource.driverClassName"</font>, <font color="red">"org.h2.Driver"</font>));
&#160;&#160;&#160;&#160;&#160;&#160;&#160; pds.init();
&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; RuntimeEnvironment environment = RuntimeEnvironmentBuilder.getDefault()
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .addAsset(ResourceFactory.newClassPathResource(process), ResourceType.BPMN2)
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .get();
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>return</b></font> RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment);
&#160;&#160;&#160; <font color="navy">}</font>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Please let me know, where/how to fix the problem.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>With kind regards,</p><p>Tom</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/832618#832618">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>