4 Replies Latest reply on Aug 29, 2007 7:33 PM by kukeltje

    Unable to insert new process definitions.

    mihochan

      I am trying to insert process definitions into a MySQL database from a stand-alone application.

      The process definitions are good as they install from JBoss. The problem seems to be with the persistence configuration but I can't see what is going wrong.

      I can also contact the database to retrieve process definitions.

      org.jbpm.JbpmException: problem closing services {persistence=org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session}
       [java] at org.jbpm.svc.Services.close(Services.java:223)
       [java] at org.jbpm.JbpmContext.close(JbpmContext.java:139)
      ....
       Caused by: org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session
       [java] at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:172)
       [java] at org.jbpm.svc.Services.close(Services.java:211)
       [java] ... 22 more
       [java] Caused by: org.hibernate.exception.DataException: could not insert: [org.jbpm.graph.node.StartState]
       [java] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:77)
       [java]
      ...
       Caused by: java.sql.SQLException: Data too long for column 'ISASYNC_' at row 1
       [java] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2847)
       [java] at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531)
       [java] at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622)
       [java] at com.mysql.jdbc.Connection.execSQL(Connection.java:2376)
       [java] at com.mysql.jdbc.Connection.execSQL(Connection.java:2297)
       [java] at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1860)
       [java] at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1957)
       [java] at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1880)
       [java] at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1741)
       [java] at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:73)
       [java] at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:33)
       [java] ... 53 more
      


      The jbpm.cfg.xml file;

      <jbpm-configuration>
       <jbpm-context>
       <service name='persistence' factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />
       </jbpm-context>
       <string name="resource.hibernate.cfg.xml" value="jbpm-hibernate.xml" />
      </jbpm-configuration>
      


      and the referenced hibernate config file;

      <hibernate-configuration>
      
       <session-factory>
      
       <!-- jdbc connection properties -->
      
       <property name="hibernate.cache.use_second_level_cache">false</property>
       <property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
      
       <!-- connection settings for stand-alone application -->
       <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
       <!-- <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property> -->
       <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
       <property name="hibernate.connection.url">jdbc:mysql://localhost/jbpmtest</property>
       <property name="hibernate.connection.username">jbpmuser</property>
       <property name="hibernate.connection.password">password</property>
       <property name="hibernate.connection.pool_size">3</property>
      
      
       <!-- other hibernate properties -->
       <property name="hibernate.show_sql">false</property>
       <property name="hibernate.format_sql">true</property>
       <property name="hibernate.use_sql_comments">true</property>
      
      <!-- Enable Hibernate's automatic session context management -->
       <property name="current_session_context_class">thread</property>
      


      Any help would be greatly appreciated. Thanks

        • 1. Re: Unable to insert new process definitions.
          mihochan

          Found the problem

          Turning the following configuration option OFF removes the error.


           <property name="hibernate.use_sql_comments">false</property>
          


          Looks like a bug to me.

          • 2. Re: Unable to insert new process definitions.

            Tom,

            Googling {hibernate.use_sql_comments mysql}

            leads to
            http://opensource.atlassian.com/projects/hibernate/browse/HHH-2178

            suggesting that a newer MySQL may solve your problem.
            (I know you already have a good workaround - I mainly wanted to get this into the forum for future searching by others.)

            -Ed Staub

            • 3. Re: Unable to insert new process definitions.
              kinshuk_in

              This did'nt work for me, both for ISASYNC_ and all other bit columns. No matter which version and driver I used on mySQL. What worked was changing all the bit fields in mysql to tinyint(1). This issue is probably due to - http://jira.jboss.com/jira/browse/BPEL-182 or http://jira.jboss.com/jira/browse/JBPM-443

              sticking the ALTER script here :...

              ALTER TABLE JBPM_PROCESSDEFINITION MODIFY ISTERMINATIONIMPLICIT_ TINYINT(1);
              ALTER TABLE JBPM_ACTION MODIFY ISASYNC_ TINYINT(1);
              ALTER TABLE JBPM_ACTION MODIFY ISPROPAGATIONALLOWED_ TINYINT(1);
              ALTER TABLE JBPM_NODE MODIFY ISASYNC_ TINYINT(1);
              ALTER TABLE JBPM_NODE MODIFY ISASYNCEXCL_ TINYINT(1);
              ALTER TABLE JBPM_NODE MODIFY CREATETASKS_ TINYINT(1);
              ALTER TABLE JBPM_NODE MODIFY ENDTASKS_ TINYINT(1);
              ALTER TABLE JBPM_PROCESSINSTANCE MODIFY ISSUSPENDED_ TINYINT(1);
              ALTER TABLE JBPM_TASK MODIFY ISBLOCKING_ TINYINT(1);
              ALTER TABLE JBPM_TASK MODIFY ISSIGNALLING_ TINYINT(1);
              ALTER TABLE JBPM_TASKINSTANCE MODIFY ISCANCELLED_ TINYINT(1);
              ALTER TABLE JBPM_TASKINSTANCE MODIFY ISSUSPENDED_ TINYINT(1);
              ALTER TABLE JBPM_TASKINSTANCE MODIFY ISOPEN_ TINYINT(1);
              ALTER TABLE JBPM_TASKINSTANCE MODIFY ISSIGNALLING_ TINYINT(1);
              ALTER TABLE JBPM_TASKINSTANCE MODIFY ISBLOCKING_ TINYINT(1);
              ALTER TABLE JBPM_TOKEN MODIFY ISABLETOREACTIVATEPARENT_ TINYINT(1);
              ALTER TABLE JBPM_TOKEN MODIFY ISTERMINATIONIMPLICIT_ TINYINT(1);
              ALTER TABLE JBPM_TOKEN MODIFY ISSUSPENDED_ TINYINT(1);

              • 4. Re: Unable to insert new process definitions.
                kukeltje

                this all is even in the wiki!!!