cancel
Showing results for 
Search instead for 
Did you mean: 

Using both TaskQuery and NativeTaskQuery

c_arunrathnakum
Champ in-the-making
Champ in-the-making
Hi,
Is there any way that i can use createTaskQuery and createNativeTaskQuery for the same taskService Object?

Like:

TaskService taskService = engine.getTaskService();

taskService.createNativeTaskQuery().sql("select * from "+managementService.getTableName(Task.class)+" T where T.name_ ilike #{taskName}").parameter("taskName", "user task").list();

taskService.createTaskQuery().suspended();



The objective is to get the tasks with name 'User Task' that are suspended..

Note: Why i use createNativeTaskQuery is that i use postgres database which does not support in-case sensitive search for taskQuery.taskNameLike


Currently, it is returning the tasks returned by taskQuery not nativetaskquery.

Can u suggest me a way.



Thanks and Regards,
Arun.C…
3 REPLIES 3

frederikherema1
Star Contributor
Star Contributor
Don't really see what your problem is. Do you want to combine UserTasks from TaskQuery and NatvieTaskQuery? Why not include the SQL you need (the SQL generated by suspended()) in the NativeQuery?

c_arunrathnakum
Champ in-the-making
Champ in-the-making
If i m using SQLs instead of API, will there be any changes in performance?

jbarrez
Star Contributor
Star Contributor
No, in the end the API is just a wrapper around the SQL calls.