SQL Injection issue for history Service query

Hi Team,
We have used below query to extract data from Camunda history service
In the above query, definitionKey is the input parameter for the rest endpoint

This implementation works fine but getting SQL injection vulnerability in the report.

How can we fix this or any other way (PreparedStatement) to implement the above logic to camuda ?