Rest API 'history/detail' with query parameters userOperationId, variableUpdates throws syntax error exception

Hi,
We are using camunda spring boot 7.16.0 camunda version.
when we try try to access endpoint: GET /history/detail with query parameters: userOperationId, variableUpdates , there is syntax error in DB query:

Rest endpoint is: engine-rest/history/detail?userOperationId=*******************************&variableUpdates=true

Exception when we call history/details rest end point is:

SQL: select * from ( select a., ROWNUM rnum from ( select distinct RES. from ACT_HI_DETAIL RES left join ( SELECT A.* FROM ACT_RU_AUTHORIZATION A WHERE A.TYPE_ < 2 AND ( A.USER_ID_ in ( ?, ‘') OR A.GROUP_ID_ IN ( ? ) ) AND ( ( A.RESOURCE_TYPE_ = ? AND BITAND(A.PERMS_,?) = ? ) ) ) AUTH ON (AUTH.RESOURCE_ID_ in ( RES.PROC_DEF_KEY_, '’ )) WHERE RES.TYPE_ = ? RES.OPERATION_ID_ = ? and ( (RES.EXECUTION_ID_ is not null AND AUTH.RESOURCE_ID_ IS NOT NULL ) or RES.EXECUTION_ID_ is null ) order by RES.ID_ asc ) a where ROWNUM < ?) where rnum >= ?

### Cause: java.sql.SQLSyntaxErrorException: ORA-00907: missing right parenthesis

after investigation we found that there is AND keyword missing at the highlighted point in above query .

also after checking HistoricDetail.xml at org/camunda/bpm/engine/impl/mapping/entity/HistoricDetail.xml, we could see same issue: