We couldn't load all Actvitity tabs. Refresh the page to try again.
If the problem persists, contact your Jira admin.
Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-14787

Boolean/Integer problem with H2 database in Test API

      Environment (Required on creation): 

      OS: Any
      Java/Maven/Gradle/IDE: Any

      Database: H2 - Version [2.1.210,)

      Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket):

      H2 database is used for unit tests; The lower versions of H2 have security issue and with newer versions, an exception occures when trying to start the process instance and complete the external task:

       

          @Test
          public void testDummyExternalTask() {
              Map<String, Object> processVars = new HashMap<>();
              processVars.put("var1", 1000002d);    
              ProcessInstance instance = runtimeService().startProcessInstanceByKey("DUMMY_PROCESS_ID", processVars);
              assertThat(instance).isWaitingAt("DUMMY_TASK_ID").externalTask().hasTopicName("DUMMY_TOPIC_NAME");
              complete(externalTask());
          }

      Exception message:

       

       

      Cause: org.h2.jdbc.JdbcSQLSyntaxErrorException: Values of types "BOOLEAN" and "INTEGER" are not comparable;

       

      an exception occures in Camunda Test API (org.camunda.bpm.engine.test.assertions.bpmn

      The full description and stack trace is in the attached file - error_log.txt

      Steps to reproduce (Required on creation)

      1. create a client worker spring boot project for a camunda 7 engine to complete the external tasks.
      2. design a simple BPMN process with an external task
      3. attache the bpmn to the project source resources
      4. write a unit test using following packages and annotations: org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests, @ExtendWith(ProcessEngineCoverageExtension.class)
      5. The test method should create a ProcessInstance using runtimeService().startProcessInstanceByKey , check the external task and related topic and finally complete the task using complete(externalTask());
      6. Run the test the error occures in the H2 database of camunda engine for test.

      A sample project can be found here https://github.com/camunda-consulting/camunda7-order-process-app

      Observed Behavior (Required on creation):

      An error occured:

       

      ### Cause: org.h2.jdbc.JdbcSQLSyntaxErrorException: Values of types "BOOLEAN" and "INTEGER" are not comparable; SQL statement:

       

       

      Expected behavior (Required on creation):

      The H2/SQL Syntax error in engine should not occur. 

      Root Cause (Required on prioritization):

      Newer versions of H2 supports True/False for boolean values instead of integer values, the error happens when an integer value like 0 or 1 is used for boolean columns.

      Solution Ideas (Optional):

      The executed query on database should have "True/False" values for boolean columns and not 1 or 0.

      Hints (optional):

      If hibernate is used, this question on stackowerflow has a nice solution: https://stackoverflow.com/questions/70716917/

        This is the controller panel for Smart Panels app

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

            Boolean/Integer problem with H2 database in Test API

                Environment (Required on creation): 

                OS: Any
                Java/Maven/Gradle/IDE: Any

                Database: H2 - Version [2.1.210,)

                Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket):

                H2 database is used for unit tests; The lower versions of H2 have security issue and with newer versions, an exception occures when trying to start the process instance and complete the external task:

                 

                    @Test
                    public void testDummyExternalTask() {
                        Map<String, Object> processVars = new HashMap<>();
                        processVars.put("var1", 1000002d);    
                        ProcessInstance instance = runtimeService().startProcessInstanceByKey("DUMMY_PROCESS_ID", processVars);
                        assertThat(instance).isWaitingAt("DUMMY_TASK_ID").externalTask().hasTopicName("DUMMY_TOPIC_NAME");
                        complete(externalTask());
                    }

                Exception message:

                 

                 

                Cause: org.h2.jdbc.JdbcSQLSyntaxErrorException: Values of types "BOOLEAN" and "INTEGER" are not comparable;

                 

                an exception occures in Camunda Test API (org.camunda.bpm.engine.test.assertions.bpmn

                The full description and stack trace is in the attached file - error_log.txt

                Steps to reproduce (Required on creation)

                1. create a client worker spring boot project for a camunda 7 engine to complete the external tasks.
                2. design a simple BPMN process with an external task
                3. attache the bpmn to the project source resources
                4. write a unit test using following packages and annotations: org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests, @ExtendWith(ProcessEngineCoverageExtension.class)
                5. The test method should create a ProcessInstance using runtimeService().startProcessInstanceByKey , check the external task and related topic and finally complete the task using complete(externalTask());
                6. Run the test the error occures in the H2 database of camunda engine for test.

                A sample project can be found here https://github.com/camunda-consulting/camunda7-order-process-app

                Observed Behavior (Required on creation):

                An error occured:

                 

                ### Cause: org.h2.jdbc.JdbcSQLSyntaxErrorException: Values of types "BOOLEAN" and "INTEGER" are not comparable; SQL statement:

                 

                 

                Expected behavior (Required on creation):

                The H2/SQL Syntax error in engine should not occur. 

                Root Cause (Required on prioritization):

                Newer versions of H2 supports True/False for boolean values instead of integer values, the error happens when an integer value like 0 or 1 is used for boolean columns.

                Solution Ideas (Optional):

                The executed query on database should have "True/False" values for boolean columns and not 1 or 0.

                Hints (optional):

                If hibernate is used, this question on stackowerflow has a nice solution: https://stackoverflow.com/questions/70716917/

                  This is the controller panel for Smart Panels app

                        Unassigned Unassigned
                        farhang.amary Farhang Amary
                        Votes:
                        0 Vote for this issue
                        Watchers:
                        2 Start watching this issue

                          Created:
                          Updated:
                          Resolved:

                              Unassigned Unassigned
                              farhang.amary Farhang Amary
                              Votes:
                              0 Vote for this issue
                              Watchers:
                              2 Start watching this issue

                                Created:
                                Updated:
                                Resolved: