We are updating the legacy application from Java 8 to Java 17 with Jakarta and the hibernate lib with postgresql. Now we have updated the with
<dependency>
<groupId>
org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.7.1</version>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-core</artifactId>
<version>6.4.4.Final</version>
</dependency>
Existing code where we are using pagination logic it causing issue with query formation
protected void setPagination(int start, int count, TypedQuery<?> query) {
// Pagination if desired.
if (start != 0 || count != 0) {
if (start >= 1) {
start = (start - 1) * count;
} else {
start = start * count;
}
**query.setFirstResult(start);
query.setMaxResults(count);**
}
}
after execution of code and getResultLIst() we are getting the below error with query.
org.hibernate.exception.SQLGrammarException: JDBC exception executing SQL [
order by 2 offset ? rows fetch first ? rows only]
[ERROR: syntax error at or near "rows" Position: 967] [n/a]
If we execute the query without this code of block we are getting the result.