createNativeTaskQuery() not found in History service

NativeTaskQuery createNativeTaskQuery() will return results only for active instances or historic data queries result also will return?

I didn’t see createNativeTaskQuery() in HistoryService.

Hey @aravindhrs,

Are you looking for this?
https://docs.camunda.org/javadoc/camunda-bpm-platform/7.11/org/camunda/bpm/engine/HistoryService.html#createHistoricTaskInstanceQuery

Cheers,
Miklas

yeah same class i’m using(HistoryService), but it doesn’t have the function createNativeTaskQuery() so that i can execute sql queries directly.

So i used like this,

return engine.getHistoryService().createNativeHistoricTaskInstanceQuery().sql(WorkflowConstants.SQL_QUERY)
        .listPage(firstResult, maxResults);

And it returns like,

[
    {
        "id": "017691bc-9111-11e9-b494-507b9dc4ed46",
        "processInstanceId": null,
        "executionId": null,
        "processDefinitionId": null,
        "processDefinitionKey": null,
        "processDefinitionName": null,
        "processDefinitionVersion": null,
        "caseInstanceId": null,
        "caseExecutionId": null,
        "caseDefinitionId": null,
        "caseDefinitionKey": null,
        "caseDefinitionName": null,
        "eventType": null,
        "sequenceCounter": 0,
        "durationInMillis": null,
        "startTime": null,
        "endTime": null,
        "taskId": null,
        "assignee": null,
        "owner": null,
        "name": null,
        "description": null,
        "dueDate": null,
        "followUpDate": null,
        "priority": 0,
        "parentTaskId": null,
        "deleteReason": null,
        "taskDefinitionKey": null,
        "activityInstanceId": null,
        "tenantId": null,
        "durationRaw": null,
        "persistentState": "org.camunda.bpm.engine.impl.history.event.HistoryEvent"
    }
]