Inject custom SQL in processInstanceQueries?

Is it somehow possible to extend processInstanceQueries with custom SQL code? I would use this for a custom where-condition.

Hi Timo!

You can make use of NativeQueries. They allow you to directly use SQL:

runtimeService.createNativeProcessInstanceQuery().sql("SELECT * FROM " + managementService.getTableName(ProcessInstance.class) WHERE <<YOUR CUSTOM WHERE HERE>>).list()

An example can be found here:

Alternatively, you can execute your own custom SQL by creating a MyBatis mapper. See here for details:

Hope it helped!