<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Type mismatches when querying executions with variables in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/type-mismatches-when-querying-executions-with-variables/m-p/195845#M148975</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I found a behaviour that I may not classify as bug, but that creates quite a bit of headaches in certain situations.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem arises when querying (process) Executions and checking for specific variable values. Especially with all Number and relative primitive types.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Scenario is this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- I start a process&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- the process (in a service task) will set a certain variable (say "varName") to a Long (as in java.lang.Long) value of (say) 12345.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- later I receive an external "something" that requires me to pick the process(es) which have such varName variable with 12345 value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-&amp;gt; this "something" will actually be the result of a JSON deserialization into a generic Map (I can't use a value object as I should be flexible enough to work with value objects that may evolve and I don't want to/can't have hard dependencies to other systems in my software)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now the problem: the JSON serializer (Jackson actually, but I think others may do the same), when not forced to match a particular type will choose the "right sized" java type based on the value received, like this&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;numbers &amp;lt;= 2^31-1 –&amp;gt; java.lang.Integer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;numbers &amp;gt;= 2^31&amp;nbsp; –&amp;gt; java.lang.Long&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(think it may also use BigInteger when appropriate, and the same widening will happen with Float, Double and BigDecimal even though I haven't tested it)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think you easily see when this is going.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When receiving such 12345 value, it will be Integer and ExecutionQueryBuilder.processVariableValueEquals("varName", 12345) will result in the lookup of an variable on the ACT_RU_VARIABLE with TYPE = "integer" and LONG = 12345, resulting in no process picked up.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As I was saying, this is not a bug, but a corner case behaviour, that requires some choices (we "banned" the use of Integers and Floats on&amp;nbsp; execution.setVariable()).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Point is that the ACT_RU_VARIABLE uses the same column (LONG) for Integer/Long and another (DOUBLE) for Float/Double, while having 4 different values for the TYPE column (integer, long, float, double), resulting in possible mismatches when these "uncontrollable conversions" happen.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wouldn't it be simpler to use the same TYPE value for the couples Long/Integer and Float/Double (yes, it may screw up the unmarshalling) or else not checking the type for the numeric types?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Aug 2014 15:21:41 GMT</pubDate>
    <dc:creator>lmollea</dc:creator>
    <dc:date>2014-08-14T15:21:41Z</dc:date>
    <item>
      <title>Type mismatches when querying executions with variables</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/type-mismatches-when-querying-executions-with-variables/m-p/195845#M148975</link>
      <description>I found a behaviour that I may not classify as bug, but that creates quite a bit of headaches in certain situations.The problem arises when querying (process) Executions and checking for specific variable values. Especially with all Number and relative primitive types.Scenario is this:- I start a pr</description>
      <pubDate>Thu, 14 Aug 2014 15:21:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/type-mismatches-when-querying-executions-with-variables/m-p/195845#M148975</guid>
      <dc:creator>lmollea</dc:creator>
      <dc:date>2014-08-14T15:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: Type mismatches when querying executions with variables</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/type-mismatches-when-querying-executions-with-variables/m-p/195846#M148976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want to use "less" types, configure them in ProcessEngineConfiguration .&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;By default following types are used:&lt;/SPAN&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variableTypes.addType(new NullType());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variableTypes.addType(new StringType(4000));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variableTypes.addType(new LongStringType(4001));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variableTypes.addType(new BooleanType());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variableTypes.addType(new ShortType());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variableTypes.addType(new IntegerType());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variableTypes.addType(new LongType());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variableTypes.addType(new DateType());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variableTypes.addType(new DoubleType());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variableTypes.addType(new UUIDType());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variableTypes.addType(new ByteArrayType());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variableTypes.addType(new SerializableType());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variableTypes.addType(new CustomObjectType("item", ItemInstance.class));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variableTypes.addType(new CustomObjectType("message", MessageInstance.class))&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Martin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Aug 2014 05:31:58 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/type-mismatches-when-querying-executions-with-variables/m-p/195846#M148976</guid>
      <dc:creator>martin_grofcik</dc:creator>
      <dc:date>2014-08-15T05:31:58Z</dc:date>
    </item>
  </channel>
</rss>

