2 Replies Latest reply on May 10, 2010 3:03 PM by Tim Struyf

    jbpm 4.1 using "clob" variables

    Tim Struyf Newbie

      We've been using JBPM for quite a while now, it's running smoothly.


      However today one of our users ran into a character size limit apparently caused by storing too large texts on the JBPM context.

      The user entered more than 280 or so characters, and apparenlty the column that jbpm uses to store the variables can only hold 255 characters , resulting in an oracle error!

       

      I noticed the variable table contains a column text_value_ which is a CLOB, and I was wondering how I could store my variables in that column to avoid the character limit.  Is there a config file I can change to make JBPM store variables as a CLOB ?

       

      Thanks!

      Tim

        • 1. Re: jbpm 4.1 using "clob" variables
          Michael Wohlfart Expert

          Hi Tim,

           

          the TEXT_VALUE_ column is for char[], the test case goes like this:

           

          public void testCharsVariable() {
              ExecutionImpl execution = startProcessInstance();
              char[] chars = generateChars("a lot of bytes ", 500);
              assertTrue(chars.length>4500);
              execution.setVariable("v", chars);
              Variable variable = execution.getVariableObject("v");
              assertEquals(TextVariable.class, variable.getClass());
              assertTrue(Arrays.equals(chars, (char[]) execution.getVariable("v")));
            }

           

          if you want to extend the size for the STRING_VALUE_ column, it is configured in

          jbpm.execution.hbm.xml:

           

          <subclass name="org.jbpm.pvm.internal.type.variable.StringVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="string">
              <property name="string" column="STRING_VALUE_" type="string"/>
          </subclass>

          • 2. Re: jbpm 4.1 using "clob" variables
            Tim Struyf Newbie

            Thanks for your reply,

             

            Adding the jbpm.execution.hbm.xml in my classes folder, changing the type to "text" and modifying the type of the column in the database to "clob" did the trick :-)

            Hope it doesnt break anything else...

             

            <subclass  name="org.jbpm.pvm.internal.type.variable.StringVariable"   extends="org.jbpm.pvm.internal.type.Variable"   discriminator-value="string">
                <property name="string"   column="STRING_VALUE_" type="text"/>
            </subclass>

             

            alter table jbpm4_variable rename column string_value_ to string_value_2;
            alter table jbpm4_variable add ( string_value_ clob ) ;
            update jbpm4_variable set string_value_ = string_value_2;
            commit;