Closed
Description
With some versions of SQL Server / PostgreSQL, calling setMaxResults()
on a native query results in parameters being added to the query:
These parameters are added as ?
and not whatever the Vert.x driver expects, resulting in errors such as this:
13:25:37,591 INFO [database] 2025-06-19 11:25:34.446 UTC [65] ERROR: syntax error at or near "?" at character 50
13:25:37,591 INFO [database] 2025-06-19 11:25:34.446 UTC [65] STATEMENT: Select * from books where author='4' fetch first ? rows only
The root cause seems to be that:
- Hibernate Reactive usually processes the SQL to replace
?
parameters with what the Vert.x driver expects:
- ... but that happens before the
setMaxResults()
SQL gets injected, therefore these injected parameters remain in the final SQL sent to the driver.