docs: @Override
      public List<Long> findTaskIds(String pattern, Character escape, TaskState state, boolean inState,
                                    Long minId, Integer maxResults, String owner, Long partition) throws Exception {
          int i = 0;
          StringBuilder find = new StringBuilder(152).append("SELECT t.ID FROM Task t");
          if (minId != null)
              find.append(++i == 1 ? " WHERE" : " AND").append(" t.ID>=:m");
          if (owner != null)
              find.append(++i == 1 ? " WHERE" : " AND").append(" t.OWNR=:o");
          if (partition != null)
              find.append(++i == 1 ? " WHERE" : " AND").append(" t.PARTN=:p");
          if (pattern != null) {
              find.append(++i == 1 ? " WHERE" : " AND").append(" t.INAME LIKE :n");
              if (escape != null)
                  find.append(" ESCAPE :e");
          }
          Map<String, Object> stateParams = null;
          if (!TaskState.ANY.equals(state))
              stateParams = appendStateComparison(find.append(++i == 1 ? " WHERE " : " AND "), state, inState);
          else if (!inState)
              return Collections.emptyList(); // empty result if someone asks for tasks not in any state
          find.append(" ORDER BY t.ID ASC");
  
          final boolean trace = TraceComponent.isAnyTracingEnabled();
          if (trace && tc.isEntryEnabled())
              Tr.entry(this, tc, "findTaskIds", pattern, escape, state + ":" + inState, minId, maxResults, owner, partition, find);
  
          List<Long> resultList;
          EntityManager em = getPersistenceServiceUnit().createEntityManager();
          try {
              TypedQuery<Long> query = em.createQuery(find.toString(), Long.class);
              if (maxResults != null)
                  query.setMaxResults(maxResults);
              if (minId != null)
                  query.setParameter("m", minId);
              if (owner != null)
                  query.setParameter("o", owner);
              if (partition != null)
                  query.setParameter("p", partition);
              if (pattern != null) {
                  query.setParameter("n", pattern);
                  if (escape != null)
                      query.setParameter("e", escape);
              }
              if (stateParams != null)
                  for (Map.Entry<String, Object> param : stateParams.entrySet())
                      query.setParameter(param.getKey(), param.getValue());
  
              resultList = query.getResultList();
          } finally {
              em.close();
          }
  
          if (trace && tc.isEntryEnabled())
              Tr.exit(this, tc, "findTaskIds", resultList.size() <= 100 ? resultList : resultList.size());
          return resultList;
      }