<!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;">
    deleteDeploypment - get SQLGrammarException: could not initialize a collection
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/tpzstamp">Ming Peng</a> in <i>jBPM</i> - <a href="http://community.jboss.org/message/546398#546398">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>I wrote a simple test code to deploy/undeploye jpdl definition. There is no issue when deploying one, but I get SQLGrammarException when trying to delete the just deployed definition. Could anyone help with this issue? Thanks.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The error in the console is:</p><pre class="jive-pre"><code class="jive-code">Hibernate: select top ? propertyim0_.KEY_ as KEY1_2_, propertyim0_.VERSION_ as VERSION2_2_, propertyim0_.VALUE_ as VALUE3_2_ from JBPM4_PROPERTY propertyim0_
Hibernate: select this_.KEY_ as KEY1_2_0_, this_.VERSION_ as VERSION2_2_0_, this_.VALUE_ as VALUE3_2_0_ from JBPM4_PROPERTY this_ where this_.KEY_=?
Hibernate: select this_.KEY_ as KEY1_2_0_, this_.VERSION_ as VERSION2_2_0_, this_.VALUE_ as VALUE3_2_0_ from JBPM4_PROPERTY this_ where this_.KEY_=?
Hibernate: select top ? jobimpl0_.DBID_ as DBID1_6_, jobimpl0_.DBVERSION_ as DBVERSION3_6_, jobimpl0_.DUEDATE_ as DUEDATE4_6_, jobimpl0_.STATE_ as STATE5_6_, jobimpl0_.ISEXCLUSIVE_ as ISEXCLUS6_6_, jobimpl0_.LOCKOWNER_ as LOCKOWNER7_6_, jobimpl0_.LOCKEXPTIME_ as LOCKEXPT8_6_, jobimpl0_.EXCEPTION_ as EXCEPTION9_6_, jobimpl0_.RETRIES_ as RETRIES10_6_, jobimpl0_.PROCESSINSTANCE_ as PROCESS11_6_, jobimpl0_.EXECUTION_ as EXECUTION12_6_, jobimpl0_.CFG_ as CFG13_6_, jobimpl0_.SIGNAL_ as SIGNAL14_6_, jobimpl0_.EVENT_ as EVENT15_6_, jobimpl0_.REPEAT_ as REPEAT16_6_, jobimpl0_.CLASS_ as CLASS2_6_ from JBPM4_JOB jobimpl0_ where (jobimpl0_.LOCKEXPTIME_ is null or jobimpl0_.LOCKEXPTIME_&lt;=?) and (jobimpl0_.DUEDATE_ is null or jobimpl0_.DUEDATE_&lt;=?) and jobimpl0_.RETRIES_&gt;0 and jobimpl0_.STATE_&lt;&gt;'suspended' order by jobimpl0_.DUEDATE_ asc
Hibernate: select deployment1_.OBJNAME_ as col_0_0_, deployment1_.DEPLOYMENT_ as col_1_0_ from JBPM4_DEPLOYMENT deployment0_, JBPM4_DEPLOYPROP deployment1_, JBPM4_DEPLOYPROP deployment2_, JBPM4_DEPLOYPROP deployment3_ where deployment1_.KEY_='pdid' and deployment1_.DEPLOYMENT_=deployment0_.DBID_ and deployment2_.KEY_='pdkey' and deployment2_.OBJNAME_=deployment1_.OBJNAME_ and deployment2_.DEPLOYMENT_=deployment0_.DBID_ and deployment3_.KEY_='pdversion' and deployment3_.OBJNAME_=deployment1_.OBJNAME_ and deployment3_.DEPLOYMENT_=deployment0_.DBID_ and deployment1_.DEPLOYMENT_=1
Hibernate: select deployment0_.DBID_ as DBID1_0_0_, deployment0_.NAME_ as NAME2_0_0_, deployment0_.TIMESTAMP_ as TIMESTAMP3_0_0_, deployment0_.STATE_ as STATE4_0_0_ from JBPM4_DEPLOYMENT deployment0_ where deployment0_.DBID_=?
Hibernate: select resources0_.DEPLOYMENT_ as DEPLOYMENT4_1_, resources0_.DBID_ as DBID1_1_, resources0_.NAME_ as NAME5_1_, resources0_.DBID_ as DBID1_5_0_, resources0_.DBVERSION_ as DBVERSION2_5_0_, resources0_.BLOB_VALUE_ as BLOB3_5_0_ from JBPM4_LOB resources0_ where resources0_.DEPLOYMENT_=?
Jun 7, 2010 3:26:18 PM org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: -5561, SQLState: 42561
Jun 7, 2010 3:26:18 PM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: incompatible data type in conversion
Hibernate: select top ? jobimpl0_.DBID_ as DBID1_6_, jobimpl0_.DBVERSION_ as DBVERSION3_6_, jobimpl0_.DUEDATE_ as DUEDATE4_6_, jobimpl0_.STATE_ as STATE5_6_, jobimpl0_.ISEXCLUSIVE_ as ISEXCLUS6_6_, jobimpl0_.LOCKOWNER_ as LOCKOWNER7_6_, jobimpl0_.LOCKEXPTIME_ as LOCKEXPT8_6_, jobimpl0_.EXCEPTION_ as EXCEPTION9_6_, jobimpl0_.RETRIES_ as RETRIES10_6_, jobimpl0_.PROCESSINSTANCE_ as PROCESS11_6_, jobimpl0_.EXECUTION_ as EXECUTION12_6_, jobimpl0_.CFG_ as CFG13_6_, jobimpl0_.SIGNAL_ as SIGNAL14_6_, jobimpl0_.EVENT_ as EVENT15_6_, jobimpl0_.REPEAT_ as REPEAT16_6_, jobimpl0_.CLASS_ as CLASS2_6_ from JBPM4_JOB jobimpl0_ where (jobimpl0_.LOCKOWNER_ is null) and jobimpl0_.RETRIES_&gt;0 and jobimpl0_.STATE_&lt;&gt;'suspended' order by jobimpl0_.DUEDATE_ asc
Jun 7, 2010 3:26:18 PM org.hibernate.engine.loading.LoadContexts cleanup
WARNING: fail-safe cleanup (collections) : org.hibernate.engine.loading.CollectionLoadContext@11ee017&lt;rs=org.hsqldb.jdbc.JDBCResultSet@790192&gt;
Jun 7, 2010 3:26:18 PM org.hibernate.engine.loading.CollectionLoadContext cleanup
WARNING: On CollectionLoadContext#cleanup, localLoadingCollectionKeys contained [1] entries
=======org.hibernate.exception.SQLGrammarException: could not initialize a collection: [org.jbpm.pvm.internal.repository.DeploymentImpl.resources#1]
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>My Environment is</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>JBPM: 4.3</p><p>Spring: 2.5.6</p><p>HsqlDB: 1.9.0 (the hsql jdbc jar file, which is under jbpm/lib, is replaced by this one)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>My Code:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</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; ClassPathXmlApplicationContext appContext = <font color="navy"><b>new</b></font> ClassPathXmlApplicationContext(<font color="red">"applicationContext.xml"</font>);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ProcessEngine processEngine = (ProcessEngine)appContext.getBean(<font color="red">"processEngine"</font>);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; RepositoryService repositoryService = processEngine.getRepositoryService();
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ExecutionService executionService = processEngine.getExecutionService();
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TaskService taskService = processEngine.getTaskService();
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
<font color="darkgreen">//&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("pd.jpdl.xml").deploy();</font>
<font color="darkgreen">//&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(deploymentId);</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; repositoryService.deleteDeployment(<font color="red">"1"</font>);
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font><font color="navy"><b>catch</b></font>(Exception e)<font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(<font color="red">"======="</font>+e);
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font>
&#160;&#160;&#160; <font color="navy">}</font>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>My Spring:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</span>

<span class="jive-xml-tag"><span>&lt;beans xmlns="</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a><span>" 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; xmlns:aop="</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/aop" target="_blank">http://www.springframework.org/schema/aop</a><span>" 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; xmlns:context="</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/context" target="_blank">http://www.springframework.org/schema/context</a><span>"
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; xmlns:tx="</span><a class="jive-link-external-small" href="http://www.springframework.org/schema/tx" target="_blank">http://www.springframework.org/schema/tx</a><span>"
&#160;&#160;&#160;&#160;&#160;&#160; xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>"
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; xsi:schemaLocation="
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a><span> </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" target="_blank">http://www.springframework.org/schema/beans/spring-beans-2.5.xsd</a><span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/aop" target="_blank">http://www.springframework.org/schema/aop</a><span> </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/aop/spring-aop-2.5.xsd" target="_blank">http://www.springframework.org/schema/aop/spring-aop-2.5.xsd</a><span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/context" target="_blank">http://www.springframework.org/schema/context</a><span> </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/context/spring-context-2.5.xsd" target="_blank">http://www.springframework.org/schema/context/spring-context-2.5.xsd</a><span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/tx" target="_blank">http://www.springframework.org/schema/tx</a><span> </span><a class="jive-link-external-small" href="http://www.springframework.org/schema/tx/spring-tx-2.5.xsd" target="_blank">http://www.springframework.org/schema/tx/spring-tx-2.5.xsd</a><span>"&gt;</span></span>



&#160; <span class="jive-xml-tag">&lt;bean id="springHelper" /&gt;</span>

&#160; <span class="jive-xml-tag">&lt;bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" /&gt;</span>

&#160; <span class="jive-xml-tag">&lt;bean id="sessionFactory"&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-comment">&lt;!-- <span class="jive-xml-tag">&lt;property name="configLocation" value="classpath:jbpm.hibernate.cfg.xml" /&gt;</span>
&#160;&#160;&#160;&#160; --&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="dataSource" ref="dataSource" /&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="mappingResources"&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;list&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;value&gt;</span>jbpm.repository.hbm.xml<span class="jive-xml-tag">&lt;/value&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;value&gt;</span>jbpm.execution.hbm.xml<span class="jive-xml-tag">&lt;/value&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;value&gt;</span>jbpm.history.hbm.xml<span class="jive-xml-tag">&lt;/value&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;value&gt;</span>jbpm.task.hbm.xml<span class="jive-xml-tag">&lt;/value&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;value&gt;</span>jbpm.identity.hbm.xml<span class="jive-xml-tag">&lt;/value&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/list&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/property&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="hibernateProperties"&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;props&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;prop key="hibernate.dialect"&gt;</span>org.hibernate.dialect.HSQLDialect<span class="jive-xml-tag">&lt;/prop&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;prop key="hibernate.show_sql"&gt;</span>true<span class="jive-xml-tag">&lt;/prop&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;prop key="hibernate.format_sql"&gt;</span>true<span class="jive-xml-tag">&lt;/prop&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/props&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/property&gt;</span>
&#160; <span class="jive-xml-tag">&lt;/bean&gt;</span>
&#160; 
&#160; <span class="jive-xml-tag">&lt;bean id="transactionManager"&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="sessionFactory" ref="sessionFactory" /&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="dataSource" ref="dataSource" /&gt;</span>
&#160; <span class="jive-xml-tag">&lt;/bean&gt;</span>

&#160; <span class="jive-xml-tag">&lt;bean id="dataSource"&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="driverClassName" value="org.hsqldb.jdbcDriver" /&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="url" value="jdbc:hsqldb:hsql://localhost/jbpm" /&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="username" value="SA" /&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;property name="password" value="" /&gt;</span>
&#160; <span class="jive-xml-tag">&lt;/bean&gt;</span>

<span class="jive-xml-tag">&lt;/beans&gt;</span>
</code></pre></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/546398#546398">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>