2 Replies Latest reply on Nov 16, 2009 3:38 PM by kukeltje

    Problems with date filters in the HistoryService (HistoryAct

      === Environment ==============================
      - jBPM Version : jbpm 4.1
      - Database : oracle(ojdbc14.jar ->Oracle JDBC Driver version - 9.0.2.0.0)
      -JDK : 1.5.09
      - Container : jboss 4.05 GA
      - Configuration :only importing files from the jbpm.jar
      lib itself? or did you create a custom config file?
      - Libraries : all jbmp libraries

      === Problem description =========================

      When I use the historyService for search activities by dates (for example activities started before or after) I checks the assigned method (historyService.createHistoryActivityInstanceQuery().executionId(idProcessInstance).startedBefore()) does not filter the records correctly. For example for the records (JBPM4_HIST_ACTINST table):

      DBID_ CLASS_ DBVERSION_ HPROCI_ TYPE_ EXECUTION_ ACTIVITY_NAME_ START_ END_ DURATION_ TRANSITION_ NEXTIDX_ HTASK_

      1328 act 1 1326 state SERVICIO_TEST2.CI-797 state2 21/10/2009 10:51:25,748000 21/10/2009 10:51:25,998000 250 1
      1327 act 1 1326 state SERVICIO_TEST2.CI-797 receive confirmation 21/10/2009 10:51:25,498000 21/10/2009 10:51:25,717000 219 to state2 1



      I execute the method

      historyService.createHistoryActivityInstanceQuery().executionId("SERVICIO_TEST2.CI-797").startedBefore(new java.util.GregorianCalendar(2009, 9,22,10,37).getTime()).list()
      and returns 0 activities.

      I think the problems is in the method org.jbpm.pvm.internal.query.HistoryActivityInstanceQueryImpl.applyParameters(Query) . This method assigns to query the "startedAfter" parameter a field of type Date instead Timestamp. If I assign the Timestamp field to "startedAfter" parameter the execution query returns two records.
      The query log are correct:

      Hibernate: select historyact0_.DBID_ as DBID1_10_, historyact0_.DBVERSION_ as DBVERSION3_10_, historyact0_.HPROCI_ as HPROCI4_10_, historyact0_.TYPE_ as TYPE5_10_, historyact0_.EXECUTION_ as EXECUTION6_10_, historyact0_.ACTIVITY_NAME_ as ACTIVITY7_10_, historyact0_.START_ as START8_10_, historyact0_.END_ as END9_10_, historyact0_.DURATION_ as DURATION10_10_, historyact0_.TRANSITION_ as TRANSITION11_10_, historyact0_.NEXTIDX_ as NEXTIDX12_10_, historyact0_.HTASK_ as HTASK13_10_, historyact0_.CLASS_ as CLASS2_10_ from JBPM4_HIST_ACTINST historyact0_ where historyact0_.START_<? and historyact0_.EXECUTION_='SERVICIO_TEST2.CI-797'