4 Replies Latest reply on Jul 13, 2007 10:59 AM by johan.parent

    Selecting non-string valued variable instances

    pbrewer_uk

      I'm using Hibernate 3.2.2 and jBPM 3.1.4 in a Seam 1.2.1GA environment.

      I have a problem with a query that should return VariableInstance entities based on a particular name and value. The variable instance is actually an instance of org.jbpm.context.exe.variableinstance.LongInstance.

      The following query returns lots of rows and one of these results shows the value as 1654.

      SELECT
       vi
      FROM
       org.jbpm.context.exe.VariableInstance vi
      WHERE
       vi.name = 'memberId'
      

      However, when I then run the following query, no results are returned.
      SELECT
       vi
      FROM
       org.jbpm.context.exe.VariableInstance vi
      WHERE
       vi.name = 'memberId'
      AND
       vi.value = 1654
      


      How can I select a variable instance based on a long value? Any hints or suggestions would be greatly appreciated, as I really have run out of ideas!

      Thanks in advance, Pete.

        • 1. Re: Selecting non-string valued variable instances
          pbrewer_uk

          If anyone has any ideas at all, I'd be very grateful.

          Thanks again, Pete.

          • 2. Re: Selecting non-string valued variable instances
            vtysh

            See on VariableInstance.hbm.xml it doesn't have a value property.

            • 3. Re: Selecting non-string valued variable instances
              pbrewer_uk

              Thanks vtysh, that's true, but LongInstance is a sub-class of VariableInstance. And it does define a value property:

              <hibernate-mapping default-access="field">
               <subclass name="org.jbpm.context.exe.variableinstance.LongInstance"
               extends="org.jbpm.context.exe.VariableInstance"
               discriminator-value="L">
               <property name="value" type="long" column="LONGVALUE_" />
               </subclass>
              </hibernate-mapping>
              


              So shouldn't it be calling the subclass value method? Or do I need to alter my query somehow to reference org.jbpm.context.exe.LongInstance?

              Cheers, Pete.

              • 4. Re: Selecting non-string valued variable instances
                johan.parent

                I'm no expert but in src\java.jbpm.test\org\jbpm\context\exe\VariableQueryDbTest.java

                there is an example of a query to another type of value. Granted it does not use org.jbpm.context.exe.VariableInstance but org.jbpm.context.exe.variableinstance.XXX directly which is probably not what you are hoping for. Jbpm has quite some code to handle the mapping of variables. I guess that's not a good sign. Maybe in a hibernate specific forum you'll have better luck.

                Regards,

                Johan