Error getting task list with hal+json content type

Hi,
I’m trying to get task lists via api rest, using hal+json content type, but i’m getting this error when I want to retrieve all the tasks with a variable. This only happens with Oracle, with h2 database there is no restriction, but I need to use Oracle DB.

01-Oct-2019 12:23:35.740 ADVERTENCIA [http-nio-8010-exec-8] org.camunda.bpm.engine.rest.exception.ProcessEngineExceptionHandler.toResponse org.camunda.bpm.engine.ProcessEngineException: Process engine persistence exception
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.rethrow(CommandInvocationContext.java:150)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:177)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:115)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:69)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
at org.camunda.bpm.engine.impl.AbstractQuery.list(AbstractQuery.java:140)
at org.camunda.bpm.engine.rest.sub.runtime.impl.FilterResourceImpl.queryVariablesInstancesByVariableScopeIds(FilterResourceImpl.java:534)
at org.camunda.bpm.engine.rest.sub.runtime.impl.FilterResourceImpl.getSortedVariableInstances(FilterResourceImpl.java:509)
at org.camunda.bpm.engine.rest.sub.runtime.impl.FilterResourceImpl.getVariableInstancesForTasks(FilterResourceImpl.java:452)
at org.camunda.bpm.engine.rest.sub.runtime.impl.FilterResourceImpl.getVariableInstancesForTasks(FilterResourceImpl.java:444)
at org.camunda.bpm.engine.rest.sub.runtime.impl.FilterResourceImpl.convertToHalTaskList(FilterResourceImpl.java:391)
at org.camunda.bpm.engine.rest.sub.runtime.impl.FilterResourceImpl.convertToHalCollection(FilterResourceImpl.java:382)
at org.camunda.bpm.engine.rest.sub.runtime.impl.FilterResourceImpl.queryHalList(FilterResourceImpl.java:239)
at org.camunda.bpm.engine.rest.sub.runtime.impl.FilterResourceImpl.executeHalList(FilterResourceImpl.java:231)
at org.camunda.bpm.engine.rest.sub.runtime.impl.FilterResourceImpl.executeList(FilterResourceImpl.java:196)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:137)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:296)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:250)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:140)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:109)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:135)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:103)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:377)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:200)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.camunda.bpm.engine.rest.filter.CacheControlFilter.doFilter(CacheControlFilter.java:44)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.camunda.bpm.engine.rest.filter.EmptyBodyFilter.doFilter(EmptyBodyFilter.java:100)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:770)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: ORA-01795: maximum number of expressions in a list is 1000 error

### The error may exist in org/camunda/bpm/engine/impl/mapping/entity/VariableInstance.xml
### The error may involve org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity.selectVariableInstanceByQueryCriteria-Inline
### The error occurred while setting parameters
### SQL: select * from ( select a.*, ROWNUM rnum from (     select distinct RES.*                 from (           select             RES.*,             (    case    when       RES.TASK_ID_ is not null       and RES.EXECUTION_ID_ is not null    then EXECUTION.ACT_INST_ID_      when       RES.CASE_EXECUTION_ID_ is not null     then RES.CASE_EXECUTION_ID_          when      EXECUTION.PARENT_ID_ is null       and RES.IS_CONCURRENT_LOCAL_ = 0    then EXECUTION.ID_          when      EXECUTION.IS_SCOPE_ = 1      and EXECUTION.PARENT_ID_ is not null       and RES.IS_CONCURRENT_LOCAL_ = 0    then PARENT_EXECUTION.ACT_INST_ID_     else EXECUTION.ACT_INST_ID_  end    ) ACT_INST_ID_            from ACT_RU_VARIABLE RES            left join ACT_RU_EXECUTION EXECUTION           on RES.EXECUTION_ID_ = EXECUTION.ID_            left join ACT_RU_EXECUTION PARENT_EXECUTION           on EXECUTION.PARENT_ID_ = PARENT_EXECUTION.ID_                         WHERE  RES.NAME_ in               (                 ?               )                                                                                                                                                                                                                         and RES.VAR_SCOPE_ in               (                 ?               ,                 ?               ,                 ?               ,                 ?               ,                 ?               ,                 ?               ,                 ?               ,                 ?               ,                 ?               ,                 ?               ,                 ?               ,                 ?               ,                 ?               ,                 ?                      ?               ,                 ?               )      ) RES         order by RES.ID_ asc       ) a where ROWNUM < ?) where rnum  >= ?
### Cause: java.sql.SQLSyntaxErrorException: ORA-01795: maximum number of expressions in a list is 1000 error

	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
	at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.selectList(DbSqlSession.java:97)
	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.selectListWithRawParameter(DbEntityManager.java:183)
	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.selectList(DbEntityManager.java:175)
	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.selectList(DbEntityManager.java:167)
	at org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceManager.findVariableInstanceByQueryCriteria(VariableInstanceManager.java:90)
	at org.camunda.bpm.engine.impl.VariableInstanceQueryImpl.executeList(VariableInstanceQueryImpl.java:179)
	at org.camunda.bpm.engine.impl.AbstractQuery.evaluateExpressionsAndExecuteList(AbstractQuery.java:189)
	at org.camunda.bpm.engine.impl.AbstractQuery.execute(AbstractQuery.java:166)
	at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:27)
	at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:106)
	... 57 more

My filter configuration is this:

{"name":"TestFilter","resourceType":"Task","query":{"processDefinitionKeyIn":["list","of","process"]},"properties":{"priority":0,"color":"#555555","refresh":false,"variables":[{"name":"businessId","label":"The Business ID"}],"showUndefinedVariable":false}}

This configuration is because I need to get the business key from the task list, since is an entity identification on my system and I need to get more information from another data base to build a rich task list.

I modified this file org/camunda/bpm/engine/impl/mapping/entity/VariableInstance.xml using FROM DUAL UNION SELECT, but it’s not the best solution.

Do you know any way to get a more or less large list of tasks from a single call?

Thanks!