<!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="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">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;">
    JBPM 4.3 - org.jbpm.api.JbpmException: couldn't acquire block of ids
</h3>
<span style="margin-bottom: 10px;">
    reply from <a href="http://community.jboss.org/people/campa">Stefano Campanini</a> in <i>jBPM</i> - <a href="http://community.jboss.org/message/539201#539201">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 <a class="jive-link-profile-small" href="http://community.jboss.org/people/swiderski.maciej">Maciej</a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I'm integratig JBPM into webapp based on Spring 3.0 all thing are managed using spring. Here sono details:</p><p>Datasource is DBCP via JNDI</p><p>TransactionManager is managed by spring</p><p>Persistace is Spring and Ibatis based</p><p>HBMSession, used only for jbpm, is configured as this</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;bean id="sessionFactory" &gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;property name="dataSource" ref="appDataSource" /&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;property name="useTransactionAwareDataSource" value="true" /&gt; &lt;!--&#160; it use transaciton spring managed --&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;property name="hibernateProperties"&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;value&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hibernate.hbm2ddl.auto=update<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hibernate.format_sql=true<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hibernate.show_sql=true<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/value&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/property&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;property name="mappingLocations"&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;list&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;value&gt;classpath:jbpm.execution.hbm.xml&lt;/value&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;value&gt;classpath:jbpm.repository.hbm.xml&lt;/value&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;value&gt;classpath:jbpm.task.hbm.xml&lt;/value&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;value&gt;classpath:jbpm.history.hbm.xml&lt;/value&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;value&gt;classpath:jbpm.identity.hbm.xml&lt;/value&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/list&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/property&gt;<br/>&#160;&#160;&#160; &lt;/bean&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>JBPM Spring iontegration is done using jbpm community way:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;bean id="springJbpmHelper" name="springHelper" &gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160; &lt;property name="jbpmCfg" value="conf/jbpm.cfg.xml" /&gt;<br/>&lt;/bean&gt;&#160;&#160;&#160; <br/>&lt;bean id="processEngine" factory-bean="springJbpmHelper" factory-method="createProcessEngine" /&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>My JBPMConfiguration is here:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;jbpm-configuration&gt;</p><p>&#160;&#160;&#160; &lt;!--&#160; &lt;import resource="jbpm.default.cfg.xml" /&gt;--&gt;</p><p>&#160;&#160;&#160; &lt;!--</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; jbpm.default.cfg.xml , modified &lt;repository-cache /&gt; with &lt;object</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; class="org.jbpm.pvm.internal.repository.RepositoryCacheImpl" /&gt;</p><p>&#160;&#160;&#160; --&gt;</p><p>&#160;&#160;&#160; &lt;import resource="jbpm.default.scriptmanager.xml" /&gt;</p><p>&#160;&#160;&#160; &lt;process-engine-context&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;repository-service /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;!--&#160;&#160;&#160; &lt;repository-cache /&gt; --&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;object /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;execution-service /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;history-service /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;management-service /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;identity-service /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;task-service /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;object&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;field name="commandService"&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ref object="txRequiredCommandService" /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/field&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/object&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;object&#160; init="eager" /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;types resource="jbpm.variable.types.xml" /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;address-resolver /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;mail-template name='task-notification'&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;to users="${task.assignee}" /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;subject&gt;${task.name}&lt;/subject&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;text&gt;&lt;![CDATA[Hi ${task.assignee}, Task "${task.name}" has been assigned to you. ${task.description}</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Sent by JBoss jBPM ]]&gt;&lt;/text&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/mail-template&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;mail-template name='task-reminder'&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;to users="${task.assignee}" /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;subject&gt;${task.name}&lt;/subject&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;text&gt;&lt;![CDATA[Hey ${task.assignee}, Do not forget about task "${task.name}". ${task.description}</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Sent by JBoss jBPM</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ]]&gt;&lt;/text&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/mail-template&gt;</p><p>&#160;&#160;&#160; &lt;/process-engine-context&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; &lt;transaction-context&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;repository-session /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;db-session /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;message-session /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;timer-session /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;history-sessions&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;object /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/history-sessions&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;mail-session&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;mail-server&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;session-properties resource="jbpm.mail.properties" /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/mail-server&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/mail-session&gt;</p><p>&#160;&#160;&#160; &lt;/transaction-context&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; &lt;!--&#160; &lt;import resource="jbpm.variable.types.cfg.xml" /&gt; --&gt;</p><p>&#160;&#160;&#160; &lt;import resource="jbpm.jpdl.cfg.xml" /&gt;</p><p>&#160;&#160;&#160; &lt;import resource="jbpm.tx.spring.cfg.xml" /&gt;</p><p>&#160;&#160;&#160; &lt;import resource="jbpm.identity.cfg.xml" /&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;/jbpm-configuration&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The issue is present also on junit testing or using the webapp ...</p><p>Junit testing enviroment is based on AbstractJUnit4SpringContextTests .</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Here some sql printed by hibernate, as you asked:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Hibernate: <br/>&#160;&#160;&#160; select<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; propertyim0_.KEY_ as KEY1_6_,<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; propertyim0_.VERSION_ as VERSION2_6_,<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; propertyim0_.VALUE_ as VALUE3_6_ <br/>&#160;&#160;&#160; from<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; JBPM4_PROPERTY propertyim0_ limit ?<br/>Hibernate: <br/>&#160;&#160;&#160; select<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; this_.KEY_ as KEY1_6_0_,<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; this_.VERSION_ as VERSION2_6_0_,<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; this_.VALUE_ as VALUE3_6_0_ <br/>&#160;&#160;&#160; from<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; JBPM4_PROPERTY this_ <br/>&#160;&#160;&#160; where<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; this_.KEY_=?<br/>Hibernate: <br/>&#160;&#160;&#160; select<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; this_.KEY_ as KEY1_6_0_,<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; this_.VERSION_ as VERSION2_6_0_,<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; this_.VALUE_ as VALUE3_6_0_ <br/>&#160;&#160;&#160; from<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; JBPM4_PROPERTY this_ <br/>&#160;&#160;&#160; where<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; this_.KEY_=?<br/>Hibernate: <br/>&#160;&#160;&#160; insert <br/>&#160;&#160;&#160; into<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; JBPM4_PROPERTY<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; (VERSION_, VALUE_, KEY_) <br/>&#160;&#160;&#160; values<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; (?, ?, ?)<br/>Hibernate: <br/>&#160;&#160;&#160; select<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; this_.KEY_ as KEY1_6_0_,<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; this_.VERSION_ as VERSION2_6_0_,<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; this_.VALUE_ as VALUE3_6_0_ <br/>&#160;&#160;&#160; from<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; JBPM4_PROPERTY this_ <br/>&#160;&#160;&#160; where<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; this_.KEY_=?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Hibernate: <br/>&#160;&#160;&#160; select<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; propertyim0_.KEY_ as KEY1_6_,<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; propertyim0_.VERSION_ as VERSION2_6_,<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; propertyim0_.VALUE_ as VALUE3_6_ <br/>&#160;&#160;&#160; from<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; JBPM4_PROPERTY propertyim0_ <br/>&#160;&#160;&#160; where<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; propertyim0_.KEY_='next.dbid'</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Do you see something wrong ?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Thanks in advance.</p><p>Stefano</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/539201#539201">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="http://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>