2 Replies Latest reply on Jun 7, 2010 4:36 AM by HuiSheng Xu

    deleteDeploypment - get SQLGrammarException: could not initialize a collection

    Ming Peng Newbie

      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.

       

      The error in the console is:

      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_<=?) and (jobimpl0_.DUEDATE_ is null or jobimpl0_.DUEDATE_<=?) and jobimpl0_.RETRIES_>0 and jobimpl0_.STATE_<>'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_>0 and jobimpl0_.STATE_<>'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<rs=org.hsqldb.jdbc.JDBCResultSet@790192>
      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]
      

       

       

      My Environment is

       

      JBPM: 4.3

      Spring: 2.5.6

      HsqlDB: 1.9.0 (the hsql jdbc jar file, which is under jbpm/lib, is replaced by this one)

       

      My Code:

       

      public static void main(String[] args) {
              try {
                  ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext("applicationContext.xml");
                  ProcessEngine processEngine = (ProcessEngine)appContext.getBean("processEngine");
                  RepositoryService repositoryService = processEngine.getRepositoryService();
                  ExecutionService executionService = processEngine.getExecutionService();
                  TaskService taskService = processEngine.getTaskService();
                  
      //            String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("pd.jpdl.xml").deploy();
      //            System.out.println(deploymentId);
                  
                  repositoryService.deleteDeployment("1");
              }catch(Exception e){
                  System.out.println("======="+e);
              }
          }
      

       

      My Spring:

       

      <?xml version="1.0" encoding="UTF-8"?>
      
      <beans xmlns="http://www.springframework.org/schema/beans" 
               xmlns:aop="http://www.springframework.org/schema/aop" 
               xmlns:context="http://www.springframework.org/schema/context"
               xmlns:tx="http://www.springframework.org/schema/tx"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="
                http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
                http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
                http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
      
      
      
        <bean id="springHelper" />
      
        <bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" />
      
        <bean id="sessionFactory">
          <!-- <property name="configLocation" value="classpath:jbpm.hibernate.cfg.xml" />
           -->
          <property name="dataSource" ref="dataSource" />
          <property name="mappingResources">
              <list>
                  <value>jbpm.repository.hbm.xml</value>
                  <value>jbpm.execution.hbm.xml</value>
                  <value>jbpm.history.hbm.xml</value>
                  <value>jbpm.task.hbm.xml</value>
                  <value>jbpm.identity.hbm.xml</value>
              </list>
          </property>
          <property name="hibernateProperties">
              <props>
                  <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
                  <prop key="hibernate.show_sql">true</prop>
                  <prop key="hibernate.format_sql">true</prop>
              </props>
          </property>
        </bean>
        
        <bean id="transactionManager">
          <property name="sessionFactory" ref="sessionFactory" />
          <property name="dataSource" ref="dataSource" />
        </bean>
      
        <bean id="dataSource">
          <property name="driverClassName" value="org.hsqldb.jdbcDriver" />
          <property name="url" value="jdbc:hsqldb:hsql://localhost/jbpm" />
          <property name="username" value="SA" />
          <property name="password" value="" />
        </bean>
      
      </beans>