Version 5

    In order to use MySQL instead of the built in HSQLDB

     

    Added MySQL driver (Connector/J mysql-connector-java-3.0.16-stable-bin.jar or a recent one) to the application library (jbpm/WEB-INF/lib). I got "java.sql.SQLException: Communication link failure: Unexpected end of input stream" with an older version of Connector/J drive.

    Then modified jbpm.properties (hibernate.) to be as follows:

       hibernate.dialect net.sf.hibernate.dialect.MySQLDialect 
       hibernate.connection.driver_class com.mysql.jdbc.Driver 
       hibernate.query.substitutions true=1, false=0 
       hibernate.connection.url jdbc:mysql://localhost:3306/jbpm 
       hibernate.connection.username <your-username> 
       hibernate.connection.password <your-password> 
    

     

    payraiseprocess.par shouldn't be "deployed" but rather the contents to be copied (not literally) to the jbpm schema (which got generated on the first run of jbpm application).

    there's an ant task (from jBPM folks) that takes a jbpm.properties file (where it should read hibernate) and accommodates the variables/files in the par file (payraiseprocess.par) to their locations in the jbpm database.

     

    I was getting a "XML document structures must start and end within the same entity." error. This was due to the truncated data stored in jbpm database (Hibernate used VARCHAR(255) instead of a blob to map). One should follow this solution to change hibernate mapping files - then do a rebuild. ThanksKarimForPointingItOut.

    The changes to the .hbm.xml files are quite minor - here they are:

     

    • In core/src/java/org/jbpm/model/definition/impl/DelegationImpl.hbm.xml replace:

           <property name="configuration" type="string" length="4000" ></property> 
             with 
           <property name="configuration" type="text" length="65535" ></property> 
    

     

    • In core/src/java/org/jbpm/model/definition/impl/FileImpl.hbm.xml replace

           <property name="bytes" type="binary" ></property> 
             with
           <property name="bytes" type="binary" length="65535" ></property> 
    

     

    (Don't forget to rebuild - then redeploy the process archive .par file once again)

     

    To resolve the comment about subqueres in the file core\src\java\org\jbpm\persistence\hibernate\HibernateSession change the following string definition 

     
    private static final String latestDefinitionQuery = "select d "  
       + "from d in class org.jbpm.model.definition.impl.DefinitionImpl "  
       + "where d.name = ? "  
       + " and d.version = ( "  
       + " select max(d2.version) "  
       + " from d2 in class org.jbpm.model.definition.impl.DefinitionImpl "  
       + " where d2.name = d.name )";  
     
    to  
     
    private static final String latestDefinitionQuery = "select d "  
       + "from d in class org.jbpm.model.definition.impl.DefinitionImpl "  
       + "where d.name = ? "  
       + " order by d.version desc "; 
     
    

     

     

    There is some second thing with the VARCHAR(255) fields, if variables in the process are bigger than 255 bytes, you must also change:

     

    • In org/jbpm/model/execution/impl/VariableInstanceImpl.hbm.xml replace

         <property name="serializedValue" type="String" ></property>
           with 
         <property name="serializedValue" type="text" length="65535"  ></property>
    

     

    • In org/jbpm/model/log/impl/ExecutionLog.hbm.xml replace

         <subclass name="org.jbpm.model.log.impl.VariableUpdateLogImpl" discriminator-value="VarUpdate">
            <property name="oldValueText" type="String" column="text1" ></property>
            <property name="newValueText" type="String" column="text2" ></property>
            <many-to-one name="variableInstance" class="org.jbpm.model.execution.impl.VariableInstanceImpl" cascade="none" column="varinst2" ></many-to-one>
         </subclass>
    
           with 
    
         <subclass name="org.jbpm.model.log.impl.VariableUpdateLogImpl" discriminator-value="VarUpdate">
            <property name="oldValueText" type="text" column="text1"  length="65535"></property>
            <property name="newValueText" type="text" column="text2"  length="65535"></property>
            <many-to-one name="variableInstance" class="org.jbpm.model.execution.impl.VariableInstanceImpl" cascade="none" column="varinst2" ></many-to-one>
         </subclass>