code: private void setLastTargetQuery(final String tenant, final long currentTimeMillis, final List<String> chunk) {
          final Map<String, String> paramMapping = Maps.newHashMapWithExpectedSize(chunk.size());
  
          for (int i = 0; i < chunk.size(); i++) {
              paramMapping.put("cid" + i, chunk.get(i));
          }
  
          final Query updateQuery = entityManager.createNativeQuery(
                  "UPDATE sp_target SET last_target_query = #last_target_query WHERE controller_id IN ("
                          + formatQueryInStatementParams(paramMapping.keySet()) + ") AND tenant = #tenant");
  
          paramMapping.forEach(updateQuery::setParameter);
          updateQuery.setParameter("last_target_query", currentTimeMillis);
          updateQuery.setParameter("tenant", tenant);
  
          final int updated = updateQuery.executeUpdate();
          if (updated < chunk.size()) {
              LOG.error("Targets polls could not be applied completely ({} instead of {}).", updated, chunk.size());
          }
      }
docs: Sets {@link Target#getLastTargetQuery()} by native SQL in order to avoid
  raising opt lock revision as this update is not mission critical and in
  fact only written by {@link ControllerManagement}, i.e. the target
  itself.