Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-7269

Historic Task Report Tenant check uses unknown column prefix

    XMLWordPrintable

Details

    Description

      If the tenant check is enabled the following code snipped will fail in an authorization test:

      public void test() {
          createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_HISTORY);
          createGrantAuthorization(TASK, ANY, userId, READ_HISTORY);
      
          historyService.createHistoricTaskInstanceReport().duration(PeriodUnit.QUARTER);
      }
      
      ### The error may exist in org/camunda/bpm/engine/impl/mapping/entity/HistoricTaskInstanceReport.xml
      ### The error may involve org.camunda.bpm.engine.impl.persistence.entity.TaskReportResultEntity.selectHistoricTaskInstanceDurationReport
      ### The error occurred while executing a query
      ### SQL: SELECT       MIN(RES.DURATION_) AS MIN_, MAX(RES.DURATION_) AS MAX_, AVG(RES.DURATION_) AS AVG_, RES.PERIOD_, 'QUARTER' AS PERIOD_UNIT_     FROM       (         SELECT                  QUARTER     (HTI.END_TIME_) AS PERIOD_, HTI.DURATION_                 FROM       ACT_HI_TASKINST HTI      WHERE END_TIME_ IS NOT NULL                                               and (HPI.TENANT_ID_ is null              )            ) RES     GROUP BY       PERIOD_
      ### Cause: org.h2.jdbc.JdbcSQLException: Column "HPI.TENANT_ID_" not found; SQL statement:
      CREATE FORCE VIEW PUBLIC._41 AS
      SELECT
          QUARTER(HTI.END_TIME_) AS PERIOD_,
          HTI.DURATION_
      FROM PUBLIC.ACT_HI_TASKINST HTI
      WHERE (END_TIME_ IS NOT NULL)
          AND (HPI.TENANT_ID_ IS NULL) [42122-168]
      

      The problem is that the tenant check uses HPI.TENANT_ID_ whereas HPI is never bound in this query.

      mgm-controller-panel

        This is the controller panel for Smart Panels app

        Attachments

          Activity

            People

              roman.smirnov Roman Smirnov
              sebastian.menski Sebastian Menski
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Salesforce