cancel
Showing results for 
Search instead for 
Did you mean: 

possible bug concerning PostgreSQL

pcsquirrel
Champ in-the-making
Champ in-the-making
hi,

i may found a bug concerning PostgreSQL and HistoricDetailQuery / VariableUpdates
histsvc.createHistoricDetailQuery().processInstanceId(task.getProcessInstanceId()).variableUpdates().list()


Exception:
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for org.activiti.engine.impl.persistence.entity.HistoricDetailEntity.selectByteArrayById_postgres
>>java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for org.activiti.engine.impl.persistence.entity.HistoricDetailEntity.selectByteArrayById_postgres
>>   at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:462)

the SELECT Statement "selectByteArray_postgres" does not exist in VariableInstance.xml

there is only "selectByteArray_postgres" and "selectByteArray".

so i changed HistoricDetail.xml

Index: HistoricDetail.xml
===================================================================
— HistoricDetail.xml   (revision 2770)
+++ HistoricDetail.xml   (working copy)
@@ -118,7 +118,7 @@
     <association property="byteArrayValue"
                  column="BYTEARRAY_ID_"
                  javaType="org.activiti.engine.impl.persistence.entity.ByteArrayEntity"
-                 select="selectByteArrayById_postgres" />
+                 select="selectByteArray" />
   </resultMap>

   <resultMap id="historicFormPropertyResultMap" extends="historicDetailResultMap" type="org.activiti.engine.impl.persistence.entity.HistoricFormPropertyEntity">

may the whole seperation of mappings for postgre is obsolete
<resultMap id="historicVariableUpdateResultMap_postgres" extends="historicDetailResultMap" type="org.activiti.engine.impl.persistence.entity.HistoricVariableUpdateEntity">

and

<resultMap id="historicDetailResultMap_postgres" type="org.activiti.engine.impl.persistence.entity.HistoricDetailEntity">

because differentiation for postgres is done in "DbSqlSessionFactory.java"


public class DbSqlSessionFactory implements SessionFactory {

  protected static final Map<String, Map<String, String>> databaseSpecificStatements = new HashMap<String, Map<String,String>>();

  static {
     //mysql specific 
    addDatabaseSpecificStatement("mysql", "selectNextJobsToExecute", "selectNextJobsToExecute_mysql");
    addDatabaseSpecificStatement("mysql", "selectProcessDefinitionsByQueryCriteria", "selectProcessDefinitionsByQueryCriteria_mysql");
    addDatabaseSpecificStatement("mysql", "selectProcessDefinitionCountByQueryCriteria", "selectProcessDefinitionCountByQueryCriteria_mysql");
    addDatabaseSpecificStatement("mysql", "selectDeploymentsByQueryCriteria", "selectDeploymentsByQueryCriteria_mysql");
    addDatabaseSpecificStatement("mysql", "selectDeploymentCountByQueryCriteria", "selectDeploymentCountByQueryCriteria_mysql");
   
    //postgres specific
    addDatabaseSpecificStatement("postgres", "insertByteArray", "insertByteArray_postgres");
    addDatabaseSpecificStatement("postgres", "updateByteArray", "updateByteArray_postgres");
    addDatabaseSpecificStatement("postgres", "selectByteArray", "selectByteArray_postgres");
    addDatabaseSpecificStatement("postgres", "selectResourceByDeploymentIdAndResourceName", "selectResourceByDeploymentIdAndResourceName_postgres");
    addDatabaseSpecificStatement("postgres", "selectResourcesByDeploymentId", "selectResourcesByDeploymentId_postgres");
    addDatabaseSpecificStatement("postgres", "selectHistoricDetailsByQueryCriteria", "selectHistoricDetailsByQueryCriteria_postgres");
    addDatabaseSpecificStatement("postgres", "insertIdentityInfo", "insertIdentityInfo_postgres");
    addDatabaseSpecificStatement("postgres", "updateIdentityInfo", "updateIdentityInfo_postgres");
    addDatabaseSpecificStatement("postgres", "selectIdentityInfoById", "selectIdentityInfoById_postgres");
    addDatabaseSpecificStatement("postgres", "selectIdentityInfoByUserIdAndKey", "selectIdentityInfoByUserIdAndKey_postgres");
    addDatabaseSpecificStatement("postgres", "selectIdentityInfoByUserId", "selectIdentityInfoByUserId_postgres");
    addDatabaseSpecificStatement("postgres", "selectIdentityInfoDetails", "selectIdentityInfoDetails_postgres");
    addDatabaseSpecificStatement("postgres", "insertComment", "insertComment_postgres");
    addDatabaseSpecificStatement("postgres", "selectCommentsByTaskId", "selectCommentsByTaskId_postgres");
    addDatabaseSpecificStatement("postgres", "selectCommentsByProcessInstanceId", "selectCommentsByProcessInstanceId_postgres");





after applying the above patch, the query is working. I haven´t tested the patch against the testsuite.

I´´m working with activiti-engine 5.5 but in 5.6 relevant code isn´t changed.

kind regards
philipp eichhorn
3 REPLIES 3

frederikherema1
Star Contributor
Star Contributor
In rev. 2768, i changed "selectByteArrayById_postgres" "selectByteArray_postgres", on may 18th… So that issue should be solved in the 5.6 version afaik.

pcsquirrel
Champ in-the-making
Champ in-the-making
sorry, it seems that i messed up my 5.6 check out

kidn regards
Philipp Eichhorn

frederikherema1
Star Contributor
Star Contributor
But thanks for reporting anyway! Keep it coming (well, hopefully you encounter no more issues) Smiley Wink