We are facing an issue with the latest version of Spring Boot 3.2.2 upgrade.
My SQL query is:
@Query(value = """
SELECT c.key, c.code, c.description \
FROM #{#entityName} c WITH (FORCESEEK) WHERE EXISTS (SELECT TOP(1) 1 FROM testData td \
WHERE td.key=c.key) AND c.key BETWEEN :minKey AND :maxKey\
""", nativeQuery = true)
List<T> getAllKeys(@Param("minKey") Long minKey, @Param("maxKey") Long maxKey);
The issue we have:
Line 1:92 mismatched input 'WITH' expecting {<EOF>, ',', CROSS, EXCEPT, FULL, GROUP, INNER, INTERSECT, JOIN, LEFT, ORDER, OUTER, RIGHT, UNION, WHERE}; Bad JPQL grammar [SELECT c.key, c.code, c.description FROM TEST c WITH (FORCESEEK) WHERE EXISTS (SELECT TOP(1) 1 FROM testData td WHERE td.key=c.key) AND c.key BETWEEN :minKey AND :maxKey]
The query was working fine before the upgrade in Spring Boot 2.6.14
Thanks for any advice to fix the issue