AnsweredAssumed Answered

issues about setting multiple variables

Question asked by changxl on Aug 2, 2016
Latest reply on Aug 5, 2016 by changxl
Hi,
   I am a developer who has used activiti for 3 years.Recently I tried to upgrade my older version(5.13) to 5.21.0 and I had some big problems, all my code are throwing exceptions at runtime! I worked hard to find the reason for 2 days. I 've tried many versions of activiti
and studied the source code and I have some bugs(or maybe not) to feedback.
   Here is the problem: in the newest version(6.0.0.Beta2) or recent versions ,like 5.21.0 down to 5.18.0 (5.16 is ok),when I put multi varibles at one time,and when I start the process or complete user tasks,there will always be an exception (Cause: org.h2.jdbc.JdbcSQLException: Serialization failed)! It is very easy to reproduce the scenario:
        Map<String, Object> variableMap = new HashMap<String, Object>();
   variableMap.put("var1", "var1");
   variableMap.put("var2", "var2");
   ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("AnyProcessDefKey", variableMap);
   So I studied vary version's code and compare the differences between each other and finally find that ,in recent activiti versions, there are many newly added bulk operation like "bulkInsertHistoricDetailVariableInstanceUpdate" or bulkInsertXXXXXX, of course the popurse is to improve the performance,I think.And the exception will be thrown in the versions which has the "bulkXX" methods.
     according to the exception stack,I modified the mybatis mapping files and solved the problem temporarily,but I don't think it's the best solution, Here is my approach :
    in file HistoricDetail.xml ,insert id="bulkInsertHistoricVariableInstance" & id="bulkInsertHistoricDetailVariableInstanceUpdate_oracle",I modified the sql's two parameters:
1. #{historicDetailVariableInstance.variableType, jdbcType=VARCHAR} –>#{historicDetailVariableInstance.variableTypeName, jdbcType=VARCHAR}
2.#{historicDetailVariableInstance.byteArrayRef, typeHandler=ByteArrayRefTypeHandler} –> #{historicDetailVariableInstance.byteArrayRef.id, jdbcType=VARCHAR}
   and in file HistoricVariableInstance.xml, I made the same changes.
   Although this is enough to solve my problem but I still deadly wonder the reason.
   For one hand,I think multi varibles is allowed because the parameter is a Map type and It does work fine in lower version,like 5.16;for another hand , I didn't see any other user have met the same problem like me and there's no same questions in the forum or other website.
   look forward for your replys !Anybody plz help!  Sorry for the bad English,this is my first one..
  

Outcomes